前言
在Unix下终端开发时,经常会搭配 oh-my-zsh 来使用。 oh-my-zsh 中默认内置 git 插件,且支持许多 git alias 的命令,这里对常见的命令进行总结,以供查阅。
常用命令
``
alias g=‘git’
配置信息
alias gcf=‘git config --list’
分支命令
alias gb=‘git branch’
alias gba=‘git branch -a’
alias gbd=‘git branch -d’
alias gbr=‘git branch -r’
alias gco=‘git checkout’
alias gcb=‘git checkout -b’
alias gcd=‘git checkout develop’
alias gcm=‘git checkout master’
代码提交
alias ga=‘git add’
alias gcam=‘git commit -a -m’
alias gcmsg=‘git commit -m’
pull and merge
alias gl=‘git pull’
alias gm=‘git merge’
alias gmom=‘git merge origin/master’
alias gp=‘git push’
alias gpu=‘git push upstream’
diff 和 log
alias gd=‘git diff’
alias glg=‘git log --stat’
alias glgp=‘git log --stat -p’
alias gsb=‘git status -sb’
alias gst=‘git status’
alias gcp=‘git cherry-pick’
撤销和重置
alias grh=‘git reset’
alias grhh=‘git reset --hard’
alias groh=‘git reset origin/$(git_current_branch) --hard’
alias grm=‘git rm’
暂存
alias gstl=‘git stash list’
alias gstaa=‘git stash apply’
alias gstp=‘git stash pop’