RuRu

The website of Russell Jennings

Tip: Order Git Branches by Last Commit Age

A great tool for git users

To try this out on your own, put this in your terminal:

1
for k in `git branch|sed s/^..//`;do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" "$k"`\\t"$k";done|sort

or create an alias for it in your ~/.bash_profile

1
alias git-branch-list='for k in `git branch|sed s/^..//`;do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" "$k"`\\t"$k";done|sort'

See the post for this trick here. You can find other cool tricks on commandlinefu.