Last active
January 4, 2016 16:59
-
-
Save baseonmars/8650836 to your computer and use it in GitHub Desktop.
List git branches in order of age
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
#!/bin/bash | |
location="--list" | |
while getopts rla opt; do | |
case $opt in | |
r) | |
location="--remote" | |
;; | |
l) | |
location="--list" | |
;; | |
a) location="--all" | |
;; | |
esac | |
done | |
echo $r | |
for k in `git branch $location|grep -v -e "HEAD ->"|sed s/^..//`;do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" "$k" `\\t"$k";done|sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment