Skip to content

Instantly share code, notes, and snippets.

@minrk
Created July 29, 2013 19:37
Show Gist options
  • Save minrk/6107101 to your computer and use it in GitHub Desktop.
Save minrk/6107101 to your computer and use it in GitHub Desktop.
preserving completion for git aliases.
# define some aliases
alias m="git checkout master"
alias mp="git checkout master && git pull"
alias ci="git commit"
alias c="git checkout"
alias co="git checkout"
alias b="git checkout -b"
alias pr="git push mine && hub pull-request"
alias uncommit="git log -1 && git reset HEAD^1"
# register existing git completions for these aliases if git-completion is available
if [ ! -z "$(declare -f __git_complete)" ]; then
__git_complete ci _git_commit
__git_complete c _git_checkout
__git_complete co _git_checkout
__git_complete mp _git_pull
fi
@minrk
Copy link
Author

minrk commented Jul 29, 2013

For @ivanov, from SO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment