參考來源:http://progit.org/book/
其實就是設定 ~/.gitconfig 的內容,除了直接編輯外,也可以用指令來設定,例如:
git config --global user.name "Daniel Lin"
git config --global user.email ooo@ooo.ooo.ooo
git config --global core.editor vim
git config --global merge.tool vimdiff
設定完後,執行 git config –list 應該可以看到如下的內容:
user.name=Daniel Lin
user.email=ooo@ooo.ooo.ooo
core.editor=vim
merge.tool=vimdiff
事實上,在 ~/.gitconfig 會長這樣:
[user]
name = Daniel Lin
email = ooo@ooo.ooo.ooo
[core]
editor = vim
[merge]
tool = vimdiff
這些是別人的 .gitconfig:
[user]
name = Daniel Lin
email = ooo@ooo.ooo.ooo
[core]
editor = vim
[merge]
tool = vimdiff
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
pager = less -FRSX
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
[alias]
st = status
ci = commit
di = diff
co = checkout
w = whatchanged
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
[diff]
renamelimit = 0