Skip to content

Instantly share code, notes, and snippets.

@ascii-soup
Created March 12, 2013 11:01
Show Gist options
  • Save ascii-soup/5142012 to your computer and use it in GitHub Desktop.
Save ascii-soup/5142012 to your computer and use it in GitHub Desktop.
Quick zsh completer for recent branches
_recentbranches_completion() {
compadd -V $(git reflog | grep -Pi "checkout: moving from " | awk -F"moving from" '{ print $2 }' | awk -F'to' '{ print $1 }' | sed 's/ //g' | grep -Piv '[a-f0-9]{40}')
}
compdef _recentbranches_completion gitr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment