在 SVN 中,我们可以把 svn update 简写成 svn up ,但是 Git 是不支持这种写法的,因此我们要对 Git 的一些操作命令做一个别名,使得可以像 SVN 一样使用简写
Git 别名的配置格式为 git config --global alias.ci commit ,表示我们可以把 git commit 简写成 git ci,下面是一些常用的别名配置:
[root@localhost ~]# git config --global alias.ci commit [root@localhost ~]# git config --global alias.co checkout [root@localhost ~]# git config --global alias.br branch [root@localhost ~]# git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
[root@localhost ~]# git config --list | grep alias # 查看所有的别名 [root@localhost ~]# git config --global --unset alias.log # 取消指定的别名