Last active
August 29, 2015 14:01
-
-
Save gnarmis/63016a8aad4f850e7a09 to your computer and use it in GitHub Desktop.
List Git Branches by Recency
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 | |
# | |
# Blame @gnarmis if this doesn't work | |
# | |
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it | |
# and you'll be able to do `git recent-branches`. | |
# | |
# Show top 5 most recent branches: | |
# $ git recent-branches | head -n 5 | |
# | |
# | |
set -e | |
git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname)' | sed 's/refs\/heads\///g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment