每次装完git后,一点一点配置有点麻烦。
保存个配置脚本,就方便多了。每次配置一条命令就足够了
···
git config --global user.name "yourname"
git config --global user.email "youremail@xx.com"
git config --global alias.ck checkout
git config --global alias.st status
git config --global alias.co commit
git config --global alias.unstage "reset HEAD --"
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.backto "reset --hard"
git config --global alias.softto "reset --soft"
git config --global core.autocrlf false
git config --global core.safecrlf true
git config --global core.whitespace cr-at-eol
git config --global core.quotepath false
···git
前面两个是用户名和邮箱
中间的是经常使用命令的别名
后面两行是换行符相关配置。避免由于操做系统换行符不一样的缘由致使的:明明什么都没改,可是提交到远程仓库后,改了一大片的状况。。
whitespace ,让git diff 忽略不一样换行符的差异。否则总显示^M
quotepath 中文路径名正常显示 、避免 \302\265 这样的字符bash
运行命令
sh gitconfig.shspa
配置成功。保存一下。之后面得每次都一点一点敲键盘了操作系统