1.简写git命令
格式:git config –global alias.简写 原命令
例如:
//checkout简写成co
git config --global alias.co checkout
//branch简写成br
git config --global alias.br branch
//status简写成st
git config --global alias.st status
自定义之后,以后再用就可以简写,比如 git st 就相当于git status,效果如下:
2.修改git log结果的显示样式
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
但是太长了,每次都输入这么多太麻烦了,根据第1条,我们将上面一长串命令简写成lg,代码如下:
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"
以后再使用就用git lg,效果如下:
是不是很方便,赶快设置吧。