git config配置文件

Git有一个工具被称为git config,它允许你获得和设置配置变量;这些变量可以控制Git的外观和操作的各个方面。这些变量可以被存储在三个不同的位置: 

---------------------------------------------------------

1./etc/gitconfig 文件:包含了适用于系统所有用户和所有库的值。如果你传递参数选项’--system’  git config,它将明确的读和写这个文件。 

2.~/.gitconfig 文件 :具体到你的用户。你可以通过传递--global 选项使Git 读或写这个特定的文件。

3.位于git目录的config文件 (也就是 .git/config) :无论你当前在用的库是什么,特定指向该单一的库。每个级别重写前一个级别的值。因此,在.git/config中的值覆盖了在/etc/gitconfig中的同一个值。

---------------------------------------------------------

vi ~/.gitconfig

1 [user]
2 name = zhe.jxxxg
3 email = zhe.jxxxg@sixxxtech.com
4 [color]
5 ui = true
6 [core]
7 editor = vim
8
9 [alias]
10 co = checkout
11 ci = commit
12 st = status
13 br = branch -v
14 rt = reset --hard
15 unstage = reset HEAD^
16 uncommit = reset --soft HEAD^
17 l = log --pretty=oneline --abbrev-commit --graph --decorate
18 amend = commit --amend
19 who = shortlog -n -s --no-merges
20 g = grep -n --color -E
21 cp = cherry-pick -x
22 nb = checkout -b
23
24 #'git add -u' handles deleted files, but not new files
25 #'git add .' handles any current and new files, but not deleted
26 #'git addall' noe handles all changes
27 addall = !sh -c 'git add . && git add -u'
28
29 #Handy shortcuts for rebasing
30 rc = rebase --continue
31 rs = rebase --skip
32 ra = rebase --abort

原文地址:https://www.cnblogs.com/yangtze736-2013-3-6/p/3530890.html