Skip to content

Instantly share code, notes, and snippets.

@alfredormz
Created November 27, 2017 18:11
Show Gist options
  • Save alfredormz/69a2f1129caff0eae366f220bc871e62 to your computer and use it in GitHub Desktop.
Save alfredormz/69a2f1129caff0eae366f220bc871e62 to your computer and use it in GitHub Desktop.
List git branches, ordered by most recent commit
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 -r
git for-each-ref --sort=-committerdate refs/heads/
git branch --sort=-committerdate # DESC
git branch --sort=committerdate # ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment