git的配置文件分为三个层级:
1.对所有用户,位于/etc/gitconfig
2.对于当前用户,位于~/.gitconfig
3.对于该git仓,位于.git/config
建议配置当前用户的.gitconfig文件
分享一下作者的配置文件:
1 [alias] 2 amend = commit --amend 3 amendf = commit --amend --no-edit 4 br = branch 5 ct = commit 6 co = checkout 7 cp = cherry-pick 8 df = diff 9 ds = diff --staged 10 l = log 11 lg = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative 12 lp = log --pretty=oneline 13 sa = stash apply 14 sh = show 15 ss = stash save 16 st = status 17 18 [color] 19 ui = auto 20 [color "branch"] 21 current = yellow reverse 22 local = yellow 23 remote = green 24 [color "status"] 25 added = yellow 26 changed = green 27 untracked = cyan 28 [color "diff"] 29 meta = yellow 30 frag = magenta bold 31 commit = yellow bold 32 old = red bold 33 new = green bold 34 whitespace = red reverse 35 [color "diff-highlight"] 36 oldNormal = red bold 37 oldHighlight = red bold 52 38 newNormal = green bold 39 newHighlight = green bold 22 40 41 [user] 42 email = alvin@qq.com 43 name = alvin