您的位置:首页 > 其它

git常用配置及别名设置

2015-11-10 17:29 176 查看
三个不同的位置:

1./etc/gitconfig 文件:包含了适用于系统所有用户和所有库的值。如果你传递参数选项’--system’ 给 git config,它将明确的读和写这个文件。
2.~/.gitconfig 文件 :具体到你的用户。你可以通过传递--global 选项使Git 读或写这个特定的文件。
3.位于git目录的config文件 (也就是 .git/config) :无论你当前在用的库是什么,特定指向该单一的库。每个级别重写前一个级别的值。因此,在.git/config中的值覆盖了在/etc/gitconfig中的同一个值。


常用配置及别名习惯:

[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = /Users/andy/.gitignore_global
# 提交时, 不允许混合不同的换行符
safecrlf = true
# 检出和提交时, 都不自动转换换行符
autocrlf = false
[web]
browser = google-chrome
[rerere]
enabled = 1
autoupdate = 1
[alias]
s = status
st = status
sb = status -s -b
#############
d = diff
di = diff
dc = diff --cached
dk = diff --check
dck = diff --cached --check
#############
c = commit
ca = commit -a
cm = commit -m
ci = commit
#############
l = log --oneline
lg = log --oneline --graph --decorate
#############
o = checkout
co = checkout
ob = checkout -b
cob = checkout -b
#############
b = branch
bv = branch -vv
ba = branch -a
bd = branch -d
br = branch -r
#############
f = fetch
fo = fetch origin
#############
m = merge
#############
ps = push
pl = pull
pb = pull --rebase
psf = push -f
psu = push -u
plu = pull -u
pso = push origin
plo = pull origin
pbo = pull --rebase origin
psfo = push -f origin
psuo = push -u origin
pluo = pull -u origin
#############
rb = rebase
#############
re = reset
rh = reset HEAD
reh = reset --hard
rem = reset --mixed
res = reset --soft
rehh = reset --hard HEAD
remh = reset --mixed HEAD
resh = reset --soft HEAD
#############
w = show
#############
human = name-rev --name-only --refs=refs/heads/*
[color]
ui = true
[color "branch"]
current = yellow bold
local = green bold
remote = cyan bold
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = green bold
changed = yellow bold
untracked = red bold
[push]
default = upstream
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: