Skip to content

Instantly share code, notes, and snippets.

@prichodko
Last active April 17, 2018 09:17
Show Gist options
  • Save prichodko/f713af53752738fd635fa510871bb9cc to your computer and use it in GitHub Desktop.
Save prichodko/f713af53752738fd635fa510871bb9cc to your computer and use it in GitHub Desktop.
How to use git-completion.bash for custom commands (e.g. git-friendly)
if type __git_complete &> /dev/null; then
_branch () {
delete="${words[1]}"
if [ "$delete" == "-d" ] || [ "$delete" == "-D" ]; then
_git_branch
else
_git_checkout
fi
}
__git_complete branch _branch
__git_complete merge _git_merge
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment