转载自:http://blog.csdn.net/qinjienj/article/details/7479886
程序员都是"懒惰"的,哪怕是执行一个命令的时候少敲了一个字母也感觉特舒坦。Git就允许为命令设置别名。
以git status为例,如果敲git st
显然无法识别。
new-host-2:designer XXX$ git st git: 'st' is not a git command. See 'git --help'. Did you mean one of these? status reset stage stash svn
我们可以在 ~/.gitconfig 文件里面进行别名设置,即加上下面这几行
[alias] st = status ci = commit br = branch co = checkout df = diff
接着再敲git st
这次git st 就被识别成 git status了。
new-host-2:designer XXX$ git st # On branch master # Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded. # nothing to commit (working directory clean)
有些程序员可能会有某几个单词敲的特别不习惯,比如总把push敲成psuh,那索性就可以把 psuh 作为 push 的一个别名加到配置文件中,多省事。