Oh my zsh git plugin cheatsheet

ยท

2 min read

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

AliasCommandNotes
gbgit branchList of local branches
gbagit branch -aList of local and remote branches
gcamgit commit -amAdd all files to stage and commit
gcmsggit commit -mGit commit message
gcogit checkoutChange branch
gco -git checkout to the previous branchChange branch to the previous one
gdgit diffFiles differences in staging
gfagit fetch --all --pruneFetch all remote branches, delete branch if upstream is gone
glgit pullPull from remote
gpgit pushPush to remote
gpsupgit push --set-upstream origin [currentbranch]Set upstream branch
gstgit statusLocal 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

AliasCommandNotes
gflbsgit flow bugfix startStart a bugfix/ branch from develop
gflbfgit flow bugfix finishFinish a bugfix/ branch from develop
gbmgit branch -mRename branch
gbDgit branch -DDelete local branch with force option
gbuugit branch --unset-upstreamUnset upstream branch

๐Ÿ“š More info