Last active
January 2, 2023 23:32
-
-
Save nickcox/3ed7843d09912c93d38bc6ee90a9be14 to your computer and use it in GitHub Desktop.
Git alias to show most recently used branches
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
# http://ses4j.github.io/2020/04/01/git-alias-recent-branches/ | |
[alias] | |
lb = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment