git常用配置及别名设置

三个不同的位置: 

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


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值