Skip to content

Instantly share code, notes, and snippets.

@raharper
Created September 24, 2020 15:03
Show Gist options
  • Save raharper/488c313dfb900056424515b43efe1139 to your computer and use it in GitHub Desktop.
Save raharper/488c313dfb900056424515b43efe1139 to your computer and use it in GitHub Desktop.
gitconfig aliases for branch management
[alias]
branchname = !git rev-parse --abbrev-ref HEAD
bn = !git branchname
branchdate = !git for-each-ref --sort='-authordate' --format='%(refname)@%(authordate)' refs/heads | sed -e 's-refs/heads/--' | column -s @ -t | cat --number
bd = !git branchdate
bdget = "!sh -c 'git branchdate | tac | tail -n \"$1\" | head -n 1 | awk -F\" \" \"{print \\$2}\"' \"$1\""
cobd = "!git checkout $(git bdget \"$1\") #"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment