Skip to content

Instantly share code, notes, and snippets.

@jjthrash
Last active January 13, 2016 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjthrash/fe49da9c1f7972bfe567 to your computer and use it in GitHub Desktop.
Save jjthrash/fe49da9c1f7972bfe567 to your computer and use it in GitHub Desktop.
Put this in your path as `git-recent-branch` and you can do `git recent-branch` and `git recent-branch -r`
#!/bin/bash
branches=`git branch $* | perl -pe 's/^..(.*?)( ->.*)?$/\1/'`
for k in $branches; do
echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- |
head -n 1`\\t$k
done | sort -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment