← all posts

✨ Oh My Zsh Git Aliases

Supercharge your Git workflow in Oh My Zsh

If you manage your Git workflow via the terminal and your terminal is Oh My Zsh, then you’re in for a treat.

Oh My Zsh has a bunch of built-in aliases for Git commands which are an absolute game-changer 🀯

gst = git status # status of your repo and changes

gapa = git add --patch # choose which changes in a file to commit
gaa = git add --all # stage all your changes

gcmsg = git commit -m # commit with a message

gco = git checkout # change to a specific branch
gcb = git checkout -b # create a new branch off the current branch and change to it at the same time

gp = git push # add your changes to the remote repo
gpsup = git push --set-upstream origin $(current_branch) # push a local branch to remote

gl = git pull # obtain the latest changes from the remote repo

gm = git merge # combine various versions of a file or folder

grhh = git reset --hard # undo all your changes

gsta = git stash push # add to your stash
gstp = git stash pop #remove from your stash

See here for the complete list of aliases.

And if you forget what an alias does, just do this which <alias> eg

> which gst
gst: aliased to git status