Git 学习(篇二 –Git配置)
用户信息
当安装完 Git 应该做的第一件事就是设置你的用户名称与邮件地址。 这样做很重要,因为每一个 Git
的提交都会使用这些信息,并且它会写入到你的每一次提交中,不可更改:
$ git config --global user.name wang.mingbo
$ git config --global user.email wang.mingbo@bihn.cn
文本编辑器
既然用户信息已经设置完毕,你可以配置默认文本编辑器了,当 Git 需要你输入信息时会调用它。 如果未配置,Git
会使用操作系统默认的文本编辑器,通常是 Vim。 如果你想使用不同的文本编辑器,例如 Emacs,可以这样做:
$ git config --global core.editor emacs
检查配置信息
如果想要检查你的配置,可以使用 git config –list 命令来列出所有 Git 当时能找到的配置。
core.symlinks=false
core.autocrlf=input
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
user.name=wang.mingbo
user.email=wang.mingbo@bihn.cn
你可以通过输入 git config key: 来检查 Git 的某一项配置
$ git config --global user.name
获取帮助
若你使用 Git 时需要获取帮助,有三种方法可以找到 Git 命令的使用手册:
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
ps :man命令不太懂是干嘛的
例如,要想获得 stash 命令的手册,执行
$ git help stash