【转】oh-my-zsh: git Plugin

+++

The git Plugin

The git plugin provides many aliases and a few useful functions.

Enable it by adding git to the plugins array before sourcing OMZ (see [[Plugins]]).

Aliases

AliasCommand
ggit
gagit add
gaagit add –all
gapagit add –patch
gaugit add –update
gbgit branch
gbagit branch -a
gbdagit branch –merged \command grep -vE “^(*\smasters$)” \command xargs -n 1 git 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
gcagit commit -v -a
gcamgit commit -a -m
gca!git commit -v -a –amend
gcan!git commit -v -a -s –no-edit –amend
gcbgit checkout -b
gcfgit config –list
gclgit clone –recursive
gcleangit clean -df
gcmgit checkout master
gcdgit checkout develop
gcmsggit commit -m
gcogit checkout
gcountgit shortlog -sn
gcpgit cherry-pick
gcpagit cherry-pick –abort
gcpcgit cherry-pick –continue
gcsgit commit -S
gdgit diff
gdcagit diff –cached
gdtgit diff-tree –no-commit-id –name-only -r
gdwgit diff –word-diff
gfgit fetch
gfagit fetch –all –prune
gfogit fetch origin
gggit gui citool
ggagit gui citool –amend
ggfgit push –force origin $(current_branch)
ghhgit help
ggpullggl
ggpurggu
ggpushggp
ggsupgit branch –set-upstream-to = origin/$(current_branch)
gpsupgit push –set-upstream origin $(current_branch)
gignoregit update-index –assume-unchanged
gignoredgit ls-files -v \grep “^[[:lower:]]”
git-svn-dcommit-pushgit svn dcommit && git push github master:svntrunk
gkgitk –all –branches
gkegitk –all $(git log -g –pretty = format:%h)
glgit pull
glggit log –stat –color
glgggit log –graph –color
glggagit log –graph –decorate –all
glgmgit log –graph –max-count = 10
glgpgit log –stat –color -p
glogit log –oneline –decorate –color
gloggit log –oneline –decorate –color –graph
glolgit log –graph –pretty = format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –abbrev-commit
glolagit log –graph –pretty = format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –abbrev-commit –all
glp_git_log_prettily
gmgit merge
gmomgit merge origin/master
gmtgit mergetool –no-prompt
gmtvimgit mergetool –no-prompt –tool = vimdiff
gmumgit merge upstream/master
gpgit push
gpdgit push –dry-run
gpoatgit push origin –all && git push origin –tags
gpristinegit reset –hard && git clean -dfx
gpugit push upstream
gpvgit push -v
grgit remote
gragit remote add
grbgit rebase
grbagit rebase –abort
grbcgit rebase –continue
grbigit rebase -i
grbmgit rebase master
grbsgit rebase –skip
grhgit reset HEAD
grhhgit reset HEAD –hard
grmvgit remote rename
grrmgit remote remove
grsetgit remote set-url
grtcd $(git rev-parse –show-toplevel \\echo “.”)
grugit reset —
grupgit remote update
grvgit remote -v
gsbgit status -sb
gsdgit svn dcommit
gsigit submodule init
gspsgit show –pretty = short –show-signature
gsrgit svn rebase
gssgit status -s
gstgit status
gstagit stash save
gstaagit stash apply
gstdgit stash drop
gstlgit stash list
gstpgit stash pop
gstcgit stash clear
gstsgit stash show –text
gsugit submodule update
gtsgit tag -s
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
glumgit pull upstream master
gvtgit verify-tag
gwchgit whatchanged -p –abbrev-commit –pretty = medium
gwipgit add -A; git rm $(git ls-files –deleted) 2> /dev/null; git commit -m “–wip–“

Deprecated Aliases

These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.

AliasCommandModification
gapgit add –patchnew alias gapa
gclgit config –listnew alias gcf
gdcgit diff –cachednew alias gdca
gdtgit difftoolno replacement
ggpullgit pull origin $(current_branch)new alias ggl (ggpull still exists for now though)
ggpurgit pull –rebase origin $(current_branch)new alias ggu (ggpur still exists for now though)
ggpushgit push origin $(current_branch)new alias ggp (ggpush still exists for now though)
gkgitk –all –branchesnow aliased to \gitk --all --branches
glggit log –stat –max-count = 10now aliased to git log --stat --color
glgggit log –graph –max-count = 10now aliased to git log --graph --color
gwcgit whatchanged -p –abbrev-commit –pretty = mediumnew alias gwch
gwipgit add -A; git ls-files –deleted -z \xargs -r0 git rm; git commit -m “–wip–“now aliased to git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"

Functions

Current

CommandDescription
current_branchReturn the name of the current branch
current_repositoryReturn the names of the current remotes
git_current_user_nameReturns the user.name config value
git_current_user_emailReturns the user.email config value

WiP

These features allow to pause a branch development and switch to another one (_”Work in Progress”_, or wip). When you want to go back to work, just unwip it.

CommandDescription
work_in_progressEchoes a warning if the current branch is a wip
gwipCommit wip branch
gunwipUncommit wip branch
    原文作者:xinjiguaike
    原文地址: https://segmentfault.com/a/1190000015743996
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞