Git实用配置笔记
作者:James Zhu (fatindeed@hotmail.com)
创建日期:2018-09-12
正文
在用户主目录下,有一个 .gitconfig
文件。这个文件为当前用户的git默认配置。
$ cat ~/.gitconfig
[user]
name = James
email = fatindeed@hotmail.com
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[core]
excludesFile = ~/.git/.gitignore
hooksPath = ~/.git/hooks
mergeOptions = --no-edit
quotePath = off
前两个没什么特别说的,主要说一下 core
下面3个配置的作用:
core.excludesFile
配置全局排除文件,具体gitignore相关资料请查阅此文。
core.hooksPath
默认hooksPath为
$GIT_DIR/hooks
,即每个Git库下的hooks目录。将它配置为绝对路径后,即所有Git库使用同一个hooks目录。core.mergeOptions
在执行
git merge
等命令时,会唤醒编辑器,让你输入合并提交消息。配置该选项后,不会出现编辑器界面,直接提交。core.quotePath
在执行
git status
等命令时,对于中文文件名会进行转移。配置该选项后,即会直接显示中文文件名。
参考资料
Last updated