Home

Awesome

oh-my-zsh git plugin

This plugin is a complete replacement for the default oh-my-zsh git plugin, and provides quite a few useful aliases and functions. The motivation to replace the default plugin stems from the fact that it comes with some inconsistencies that make a few popular commands rather unintuitive:

The efficiency of these shortcuts is kind of lost when you have to remember different letters for the same subcommand depending on the parameter(s) you're using ...

In this plugin, great care care is taken to make sure all aliases are the most intuitive they can possibly be.
On top of that, quite a few extra functions are added.

Installation

To use this plugin, clone this repo to ~/.oh-my-zsh/custom/plugins:

git clone https://github.com/davidde/git.git ~/.oh-my-zsh/custom/plugins/git

This will automatically override the default git plugin.

If you aren't yet using the default plugin, add git to the plugins in your ~/.zshrc file:

plugins=(git)

Aliases cheatsheet

AliasCommand
ggit
gagit add
gaagit add --all
gaigit add --interactive
galiasgit_list_aliases
gamgit commit --amend -m
gamagit commit --amend -m --all
gangit commit --amend --no-edit
ganagit commit --amend --no-edit --all
gapgit add --patch
gbgit branch
gbagit branch --all
gbdgit branch --delete
gbdfgit branch --delete --force
gblgit blame
gbllgit_blame_line <file> [<from line>] [<to line>]
gblsgit branch --list | cat
gbsgit bisect
gbsbgit bisect bad
gbsggit bisect good
gbsrgit bisect reset
gbssgit bisect start
gcgit commit --verbose
gcamgit commit -am
gcamegit commit -am --allow-empty-message ""
gcamggit commit -am --gpg-sign
gcamsgit commit -am --signoff
gcemgit commit --allow-empty -m
gcfgit config
gcflgit config --list
gcflsgit config --list | cat
gclgit clone --recurse-submodules
gclcdgit_clone_and_cd
gcmgit commit -m
gcmggit commit -m --gpg-sign
gcmsgit commit -m --signoff
gcntgit_count
gcntagit_count_all
gcogit checkout
gcobgit checkout -b
gcobb"checkout branch before": git checkout -
gcocgit_checkout_child
gcodgit checkout develop
gcomgit checkout $(git_main_branch)
gcopgit_checkout_parent
gcpgit cherry-pick
gcpagit cherry-pick --abort
gcpcgit cherry-pick --continue
gdgit diff
gdsgit diff --staged
gdstgit diff stash@{0}
gdsthgit diff stash@{0} HEAD
gdstpgit diff stash@{0}^ stash@{0}
gfgit fetch
gfogit fetch origin
ggb"git graph branches"
gignoregit update-index --skip-worktree
gunignoregit update-index --no-skip-worktree
gignoredgit ls-files -v | grep ^S
glgit log --name-status
glfgit_log_file <file> [<from line>] [<to line>]
glggit log --graph
glgogit log --graph --oneline
glgsgit log --graph --stat
glogit log --oneline
glocgit_locate_string <Line-of-Code> [<file>]
gloggit log
glrgit log --reverse --name-status
glsgit ls-files
gmgit merge
gmomgit merge origin/$(git_main_branch)
gmumgit merge upstream/$(git_main_branch)
gmvgit mv
gpgit push
gpdgit push --delete
gpdogit push --delete origin
gpfgit push --force-with-lease
gptgit push && git push --tags
gplgit pull
gplrgit pull --rebase
gplrsgit pull --recurse-submodules
grgit reset
grhardgit reset --hard
grkgit reset --keep
grsgit reset --soft
grhgit_reset_head
grhhardgit_reset_head --hard
grhkgit_reset_head --keep
grhsgit_reset_head --soft
grbgit rebase
grbmgit rebase $(git_main_branch)
gremgit remote
gremagit remote add
gremrmgit remote rm
gremsetgit remote set-url
gremshgit remote show
gremvgit remote -v
grlgit reflog
grmgit rm
gsgit status
gshgit show
gshsfgit_show_stash_file <file> [<stash number>]
gssgit_status_short
gstgit stash
gstagit stash apply
gstdgit stash drop
gstlgit stash list
gstlsgit stash list | cat
gstpgit stash push
gstpopgit stash pop
gstslgit stash show -l
gstspgit stash show -p
gsubgit submodule
gsubagit submodule add
gsubigit submodule update --init
gsubplgit submodule foreach git pull
gsubplomgit submodule foreach git pull origin $(git_main_branch)
gsubsgit submodule status
gsubugit submodule update --remote --merge
gtgit tag
gtamgit tag -am
gtsmgit tag -sm
gtdgit tag --delete
gtlgit tag --list
gtlsgit tag --list | cat
gwchgit whatchanged -p
 

:warning: Note:

This cheatsheet is optimized for memorability, and may not correspond literally with the actual aliases. E.g.:

Check out all commands with usage and clarifications in your local git.plugin.zsh or the repo's source code.

Alternatively, run alias to see all alias implementations, or galias for this cheatsheet.
If you want to see any specific implementation, simply run which <alias/function>.