Skip to content

Instantly share code, notes, and snippets.

@evertramos
Forked from HSBallina/.profile
Created August 29, 2017 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evertramos/65b7c832a021990b508c2ac16741afb0 to your computer and use it in GitHub Desktop.
Save evertramos/65b7c832a021990b508c2ac16741afb0 to your computer and use it in GitHub Desktop.
Git aliases with autocompletion
echo "Hello World!
"
alias g="git"
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias gm="git merge"
alias go="git checkout"
alias gp="git pull"
alias gs='git status '
echo "Available aliases:
g git
ga git add
gb git branch
gc git commit
gd git diff
gm git merge
go git checkout
gp git push
gs git status
"
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
# Add git completion to aliases
__git_complete g __git_main
__git_complete ga _git_add
__git_complete gb _git_branch
__git_complete gc _git_commit
__git_complete gd _git_diff
__git_complete gm __git_merge
__git_complete go _git_checkout
__git_complete gp _git_pull
__git_complete gs _git_status
echo "Autocompletion loaded
"
else
echo "Failed to load autocomplete. Couldn't find ~/git-completion.bash"
echo "Can be found here: https://github.com/git/git/blob/master/contrib/completion/git-completion.bash"
fi
echo "Have a nice day!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment