Git 常用别名
几乎每个人都会使用一些方法比如 Git 别名来提高效率,几乎所有人都会把使用 git st
来代替 git status
。然而这需要手动设置,每个人也都不完全一样。
Oh My Zsh 提供了一套系统别名(alias),来达到相同的功能。比如 gst
作为 git status
的别名。而且 Git 插件是 Oh My Zsh 默认启用的,相当于你使用了 Oh My Zsh,你就拥有了一套高效率的别名,而且还是全球通用的。是不是棒棒哒?下面是一些常用的别名:
Alias | Command |
---|---|
gapa | git add --patch |
gc! | git commit -v --amend |
gcl | git clone --recursive |
gclean | git reset --hard && git clean -dfx |
gcm | git checkout master |
gcmsg | git commit -m |
gco | git checkout |
gd | git diff |
gdca | git diff --cached |
glola | git log --graph --pretty = format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all |
gp | git push |
grbc | git rebase --continue |
gst | git status |
gup | git pull --rebase |
gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--" |
完整列表请参考:https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git