Skip to content

Instantly share code, notes, and snippets.

@kshep
Last active October 3, 2023 15:48
Show Gist options
  • Save kshep/3503798 to your computer and use it in GitHub Desktop.
Save kshep/3503798 to your computer and use it in GitHub Desktop.
Show the last commit to each branch in a repo, sorted by date
% cd (your git repo)
% for remote in `git branch -r | grep -v master | grep -v develop`; do git checkout --track $remote ; done
# Once you have all branches....
% git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short)%09 %(refname:short)%09 %(authorname)' | column -t
# ... or just show me the same info for all merged branches
% for branch in `git branch --merged`; do git for-each-ref refs/heads/$branch --format='%(committerdate:short)%09 %(refname:short)%09 %(authorname)'; done | column -t | sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment