Last active
June 16, 2016 18:48
-
-
Save calvinjuarez/4089f55401bab2d8741221713e20f086 to your computer and use it in GitHub Desktop.
Git Alias for Listing Local or Remote Branches by Last Modified Date
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
[alias] | |
branch-latest = "! git-branch-latest() { if [[ $1 == \"-r\" ]]; then for branch in `git branch -r | grep -v HEAD`;do echo `git show -s --oneline --format=\"%Cblue%ci%Creset\" $branch | head -n 1` \"\t$branch\"; done | sort -r; else git for-each-ref --sort=-committerdate --format=\"%(color:blue)%(committerdate:iso)%(color:reset)%09%(refname:short)\" refs/heads/; fi }; git-branch-latest" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remote listing was adapted from https://gist.github.com/l15n/3103708#gistcomment-1581590.