git 快速配置

每次裝完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

安裝git後,新建文本文件,命名gitconfig.sh。。將上述配置粘貼進去,根據須要修改,保存,右鍵gitbash,

運行命令
sh gitconfig.shspa

配置成功。保存一下。之後面得每次都一點一點敲鍵盤了操作系統

相關文章
相關標籤/搜索