git config --global alias.st status
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.br branch
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 config --global alias.submit "push origin master"
在shell命令行下敲入以上命令,则自动添加到home路径下的.gitconfig:
[alias]
st = status
...
.gitconfig 中常用的配置还有:
[user]
email = yourname@aaa.com
name = your name
[merge]
ff =false
[credentail]
helper = store 表示自动保存用户名和米饭,后续clone时无需再输入。