I would like to use shortcuts or aliases for git commands.
git diff
git status
git push
git pull
git stash
git branch -a
How do I create shor
I would recommend oh-my-zsh git shortcuts.
It has a very thorough (more than 100 shortcuts) list.
Here is a small sample to get you started:
alias ga='git add'
alias gc='git commit -v'
alias gd='git diff'
alias gst='git status'
alias gco='git checkout'
alias gcm='git checkout master'
alias gb='git branch'
# view remote branches
alias gbr='git branch --remote'
alias gup='git pull --rebase'
alias gp='git push'
# push a newly created local branch to origin
alias gpsup='git push --set-upstream origin $(git_current_branch)'
The selection of letters in most shortcuts make them adequately intuitive.
Using the shortcuts provided by a popular and active open source project has many benefits. Some of which:
Even if you don't use zsh, you can still copy them in a regular shell configuration file like .bashrc.
I have also added
alias oh='less ~/.oh-my-zsh/plugins/git/git.plugin.zsh'
so that I can quickly read the available shortcuts right from the terminal.