設定 Git 環境
參考來源:http://progit.org/book/
在這台機器上的預設 git 設定
其實就是設定 ~/.gitconfig 的內容,除了直接編輯外,也可以用指令來設定,例如:
git config --global user.name "yuan wei"
git config --global user.email yuanwei@XXXX.gmail
git config --global core.editor vim
git config --global merge.tool vimdiff
設定完後,執行 git config –list 應該可以看到如下的內容:
user.name=yuanwei
user.email=yuanwei@XXXX.gmail
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