平时使用git命令较多时,设置别名可以节省时间。

git命令别名:

https://githowto.com/aliases

设置别名:

alias fm_update="bundle exec pod install --no-repo-update --verbose"
alias pod_update="pod install --no-repo-update --verbose"

[alias]
  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  type = cat-file -t
  dump = cat-file -p

pic

参考

后记:

用了zsh之后发现,zsh有一套自己的git别名,简洁而通用。 所以如果你使用的是zsh,那么可以参考如下别名。

Cheatsheet

Git

Dynamic access to current branch name with the current_branch function
git pull origin $(current_branch)
grb publish $(current_branch) origin
AliasCommand
ggit
gagit add
gaagit add –all
gapagit add –patch
gbgit branch
gbagit branch -a
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
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
gcsmgit commit -s -m
gcbgit checkout -b
gcfgit config –list
gclgit clone –recursive
gcleangit clean -fd
gpristinegit reset –hard && git clean -dfx
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
gdctgit describe –tags `git rev-list –tags –max-count=1`
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
ggpnpgit pull origin $(current_branch) && git push origin $(current_branch)
ggpullgit pull origin $(current_branch)
gglgit pull origin $(current_branch)
ggpurgit pull –rebase origin $(current_branch)
glumgit pull upstream master
ggpushgit push origin $(current_branch)
ggpgit push origin $(current_branch)
ggsupgit branch –set-upstream-to=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
glgit pull
glggit log –stat –max-count = 10
glgggit log –graph –max-count = 10
glggagit log –graph –decorate –all
glogit log –oneline –decorate –color
gloggit log –oneline –decorate –color –graph
glp_git_log_prettily (git log –pretty=$1)
gmgit merge
gmtgit mergetool –no-prompt
gpgit push
gpoatgit push origin –all && git push origin –tags
grgit remote
grbagit rebase –abort
grbcgit rebase –continue
grbsgit rebase –skip
grbigit rebase -i
grhgit reset HEAD
grhhgit reset HEAD –hard
grmvgit remote rename
grrmgit remote remove
grsetgit remote set-url
grtcd $(git rev-parse –show-toplevel || echo “.”)
grupgit remote update
grvgit remote -v
gsdgit svn dcommit
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
gstsgit stash show –text
gtsgit tag -s
gunignoregit update-index –no-assume-unchanged
gunwipgit log -n 1 | grep -q -c “--wip--” && git reset HEAD~1
gupgit pull –rebase
gvtgit verify-tag
gwchgit whatchanged -p –abbrev-commit –pretty = medium
gwipgit add -A; git ls-files –deleted -z | xargs -r0 git rm; git commit -m “–wip–”