If everything seems under control,
you're not going fast enough

Mario Andretti

Oh my zsh git plugin cheatsheet

Some useful shortcuts I use with oh-my-zsh git plugin.

Command Description Notes
gb git branch List of local branches
gba git branch -a List of local and remote branches
gcam git commit -am Add all files to stage and commit
gcmsg git commit -m Git commit message
gco git checkout Change branch
gco - git checkout to the previous branch Change branch to the previous one
gd git diff Files differences in staging
gfa git fetch --all --prune Fetch all remote branches, delete branch if upstream is gone
gl git pull Pull from remote
gp git push Push to remote
gpsup git push --set-upstream origin [currentbranch] Set upstream branch
gst git status Local files to commit

Add your zsh aliases #

  • Open zsh configuration file
nano ~/.zshrc
  • Add aliases using the syntax
alias [name]='[command]'

For instance, these are my aliases in .zshrc file

alias gflbs='git flow bugfix start'
alias gflbf='git flow bugfix finish'

alias gbm='git branch -m'
alias gbD='git branch -D'
alias gbuu='git branch --unset-upstream'

To apply these changes, you should close the tab and open a new one or you can run

source ~/.zshrc

or shorter version

. ~/.zshrc

My aliases #

Here are some shortcuts I added compared to the ones came with oh-my-zsh plugin

Command Description Notes
alias gflbs git flow bugfix start Start a bugfix/ branch from develop
alias gflbf git flow bugfix finish Finish a bugfix/ branch from develop
gbm git branch -m Rename branch
gbD git branch -D Delete local branch with force option
gbuu git branch --unset-upstream Unset upstream branch

📚 More info

Edit this page on GitLab

Comment on DEV or Hashnode

Take me to the next post!