由以前文章,总结得出Git的特色:git
最优的存储能力;github
非凡性能;apache
开源的;dom
管理成本低;编辑器
很容易作备份;工具
支持离线操做;gitlab
很容易定制工做流程;性能
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.spa
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.操作系统
1、配置信息
Git 自带一个 git config
的工具来帮助设置控制 Git 外观和行为的配置变量。 这些变量存储在三个不一样的位置:
/etc/gitconfig
文件: 包含系统上每个用户及他们仓库的通用配置。 若是使用带有 --system
选项的 git config
时,它会今后文件读写配置变量。
~/.gitconfig
或 ~/.config/git/config
文件:只针对当前用户。 能够传递 --global
选项让 Git 读写此文件。
当前使用仓库的 Git 目录中的 config
文件(就是 .git/config
):针对该仓库。
1)配置user.name和user.email
$ git config --global user.name 'your_name'
$ git config --global user.email 'your_email@domian.com'
① config的三个做用域
缺省等同于local
$ git config --local #local只对仓库有效
$ git config --global #global对登陆用户全部仓库有效
$ git config --system #system对系统的全部用户有效
显示config的配置。加--list
$ git config --list --local $ git config --list --global $ git config --list --system
② 设置与清除
设置,缺省等同于local
$ git config --local $ git config --global $ git config --system
清除,--unset
$ git config --unset --local user.name $ git config--unset --global user.name $ git config --unset --system user.name
③ 优先级
local > global >system
每个级别覆盖上一级别的配置,因此 .git/config
的配置变量会覆盖 /etc/gitconfig
中的配置变量。
在 Windows 系统中,Git 会查找 $HOME
目录下(通常状况下是 C:\Users\$USER
)的 .gitconfig
文件。 Git 一样也会寻找 /etc/gitconfig
文件,但只限于 MSys 的根目录下,即安装 Git 时所选的目标位置。
2、文本编辑器
既然用户信息已经设置完毕,你能够配置默认文本编辑器了,当 Git 须要你输入信息时会调用它。 若是未配置,Git 会使用操做系统默认的文本编辑器,一般是 Vim。 若是你想使用不一样的文本编辑器,例如 Emacs,能够这样作:
$ git config --global core.editor emacs
Warning:
Vim 和 Emacs 是像 Linux 与 Mac 等基于 Unix 的系统上开发者常常使用的流行的文本编辑器。 若是你对这些编辑器都不是很了解或者你使用的是 Windows 系统,那么可能须要搜索如何在 Git 中配置你最经常使用的编辑器。 若是你不设置编辑器而且不知道 Vim 或 Emacs 是什么,当它们运行起来后你可能会被弄糊涂、不知所措。
3、获取帮助
有三种方法能够找到 Git 命令的使用手册:
$ git help <verb> $ git <verb> --help $ man git-<verb>
例如,要想得到 config 命令的手册,执行
$ git help config
Git官网:
(文档:https://git-scm.com/book/zh/v2)
Github:
GitLab:
SVN: