Created
September 25, 2019 03:27
-
-
Save RatoX/fa8ff421d8ff8813fa8a06b37255f8e0 to your computer and use it in GitHub Desktop.
List last worked branchs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/bash | |
# OS x only | |
function last_branchs { | |
readarray array <<< $(git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)') | |
FIVE_DAYS_AGO=$(date -v-5d "+%s") | |
for row in "${array[@]}";do | |
row_array=(${row}) | |
date_str=${row_array[0]} | |
date_unix=$(date -j -f "%Y-%m-%d" $date_str "+%s") | |
if [ "$date_unix" -gt "$FIVE_DAYS_AGO" ] | |
then | |
echo ${row_array[@]} | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment