Skip to main content

Appendix B: zsh-git Aliases

Latest Official zsh-git: aliases

AliasCommand
ggit
gagit add
gaagit add --all
gapagit add --patch
gaugit add --update
gavgit add --verbose
gapgit apply
gaptgit apply --3way
gbgit branch
gbagit branch -a
gbdgit branch -d
gbdagit branch --no-color --merged | grep -vE "^([+*]|\s($(git_main_branch)|$(git_develop_branch))\s$)" | xargs git branch -d 2>/dev/null
gbDgit branch -D
gblgit blame -b -w
gbnmgit branch --no-merged
gbrgit branch --remote
gbsgit bisect
gbsbgit bisect bad
gbsggit bisect good
gbsrgit bisect reset
gbssgit bisect start
gcgit commit -v
gc!git commit -v --amend
gcn!git commit -v --no-edit --amend
gcagit commit -v -a
gca!git commit -v -a --amend
gcan!git commit -v -a --no-edit --amend
gcans!git commit -v -a -s --no-edit --amend
gcamgit commit -a -m
gcasgit commit -a -s
gcasmgit commit -a -s -m
gcsmgit commit -s -m
gcbgit checkout -b
gcfgit config --list
gclgit clone --recurse-submodules
gccdgit clone --recurse-submodules "$@" && cd "$(basename $_ .git)"
gcleangit clean -id
gpristinegit reset --hard && git clean -dffx
gcmgit checkout $(git_main_branch)
gcdgit checkout $(git_develop_branch)
gcmsggit commit -m
gcogit checkout
gcorgit checkout --recurse-submodules
gcountgit shortlog -sn
gcpgit cherry-pick
gcpagit cherry-pick --abort
gcpcgit cherry-pick --continue
gcsgit commit -S
gdgit diff
gdcagit diff --cached
gdcwgit diff --cached --word-diff
gdctgit describe --tags $(git rev-list --tags --max-count=1)
gdsgit diff --staged
gdtgit diff-tree --no-commit-id --name-only -r
gdnolockgit diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock"
gdupgit diff @{upstream}
gdvgit diff -w $@ | view -
gdwgit diff --word-diff
gfgit fetch
gfagit fetch --all --prune
gfggit ls-files | grep
gfogit fetch origin
gggit gui citool
ggagit gui citool --amend
ggfgit push --force origin $(current_branch)
ggflgit push --force-with-lease origin $(current_branch)
gglgit pull origin $(current_branch)
ggpgit push origin $(current_branch)
ggpnpggl && ggp
ggpullgit pull origin "$(git_current_branch)"
ggpurggu
ggpushgit push origin "$(git_current_branch)"
ggsupgit branch --set-upstream-to=origin/$(git_current_branch)
ggugit pull --rebase origin $(current_branch)
gpsupgit push --set-upstream origin $(git_current_branch)
ghhgit help
gignoregit update-index --assume-unchanged
gignoredgit ls-files -v | grep "^[[:lower:]]"
git-svn-dcommit-pushgit svn dcommit && git push github $(git_main_branch):svntrunk
gkgitk --all --branches &!
gkegitk --all $(git log -g --pretty=%h) &!
glgit pull
glggit log --stat
glgpgit log --stat -p
glgggit log --graph
glggagit log --graph --decorate --all
glgmgit log --graph --max-count=10
glogit log --oneline --decorate
glolgit log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'
glolsgit log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat
glodgit log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'
glodsgit log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short
glolagit log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all
gloggit log --oneline --decorate --graph
glogagit log --oneline --decorate --graph --all
glpgit log --pretty=\<format>
gmgit merge
gmomgit merge origin/$(git_main_branch)
gmtlgit mergetool --no-prompt
gmtlvimgit mergetool --no-prompt --tool=vimdiff
gmumgit merge upstream/$(git_main_branch)
gmagit merge --abort
gpgit push
gpdgit push --dry-run
gpfgit push --force-with-lease
gpf!git push --force
gpoatgit push origin --all && git push origin --tags
gprgit pull --rebase
gpugit push upstream
gpvgit push -v
grgit remote
gragit remote add
grbgit rebase
grbagit rebase --abort
grbcgit rebase --continue
grbdgit rebase $(git_develop_branch)
grbigit rebase -i
grbmgit rebase $(git_main_branch)
grbomgit rebase origin/$(git_main_branch)
grbogit rebase --onto
grbsgit rebase --skip
grevgit revert
grhgit reset
grhhgit reset --hard
grohgit reset origin/$(git_current_branch) --hard
grmgit rm
grmcgit rm --cached
grmvgit remote rename
grrmgit remote remove
grsgit restore
grsetgit remote set-url
grssgit restore --source
grstgit restore --staged
grtcd "$(git rev-parse --show-toplevel || echo .)"
grugit reset --
grupgit remote update
grvgit remote -v
gsbgit status -sb
gsdgit svn dcommit
gshgit show
gsigit submodule init
gspsgit show --pretty=short --show-signature
gsrgit svn rebase
gssgit status -s
gstgit status
gstagit stash push
gstagit stash save
gstaagit stash apply
gstcgit stash clear
gstdgit stash drop
gstlgit stash list
gstpgit stash pop
gstsgit stash show --text
gstugit stash --include-untracked
gstallgit stash --all
gsugit submodule update
gswgit switch
gswcgit switch -c
gswmgit switch $(git_main_branch)
gswdgit switch $(git_develop_branch)
gtsgit tag -s
gtvgit tag | sort -V
gtlgtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl
gunignoregit update-index --no-assume-unchanged
gunwipgit log -n 1 | grep -q -c "--wip--" && git reset HEAD~1
gupgit pull --rebase
gupvgit pull --rebase -v
gupagit pull --rebase --autostash
gupavgit pull --rebase --autostash -v
gupomgit pull --rebase origin $(git_main_branch)
gupomigit pull --rebase=interactive origin $(git_main_branch)
glumgit pull upstream $(git_main_branch)
gwchgit whatchanged -p --abbrev-commit --pretty=medium
gwipgit add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"
gamgit am
gamcgit am --continue
gamsgit am --skip
gamagit am --abort
gamscpgit am --show-current-patch
tip

Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using a branch name other than master. In this case, we favor the shorter, neutral and descriptive term main. This means that any aliases and functions that previously used master, will use main if that branch exists. We do this via the function git_main_branch.