Git相關的配置文件有三個git
1. /etc/gitconfig:包含了適用於系統全部用戶和全部項目的值。vim
2.~/.gitconfig:只適用於當前登陸用戶的配置。ide
3. 位於git項目目錄中的.git/config:適用於特定git項目的配置。ui
對於同一配置項,三個配置文件的優先級是1<2<3spa
[alias] 爲git命令配置別名.net
例:code
當你有了上述配置後,使用git st等同於使用git stautsorm
甚至有人喪心病狂的 設置 git lg 這種快捷方式:blog
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 ,實際執行的是「
git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit」,效果仍是不錯的。
[color] 設置git輸出着色ip
例:
設置color.ui
爲true來打開全部的默認終端着色。
對比一下,無此配置時
加入配置後