git - .gitconfig 中的 [core] 有什么作用,如何设置?

标签 git git-config

我想知道 [core] 是做什么的,以及如何设置它。我发现我的主目录中的 .gitconfig 文件是这样的:

[core]
        autocrlf = input
        safecrlf = true

[user]
        name =  
        email = 

在另一个主目录中,它看起来像这样:

[user]
        name =
        email = 
[core]
        excludesfile = /Users/chenfl84/.gitignore_global
[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

最佳答案

参见 git-config(1)手册页,或运行 git help config 以获取有关如何安排 Git 配置的一般信息。

[core] 部分指的是控制 Git 行为“核心”的事物:如何识别文件和更新、缓存、压缩等。等等。< em>等等。

默认值通常——几乎总是——你想要的,但由于很多人确实想要自定义*crlf选项,所以它们已经明确并放置在方便更换的地方。

关于git - .gitconfig 中的 [core] 有什么作用,如何设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15187693/

相关文章:

git - 如何配置 'git push -u'来推断远程分支名称?

git - 可以为 user.name Git 配置使用长的非 ascii 名称吗?

android - <remove-project> 如何在 repo list 中工作?

git - 将未推送的本地分支提交移动到新的存储库

git rebase : "Could not apply (hash)." I'm lost

windows - 将一堆文件从 Windows 复制到 ubuntu 服务器,现在所有文件都显示在 git 中已修改,并带有 ^M

git - 禁用 Android Studio 中的新 Git 分支选项

git - 如何使用 ssh key 更改 git commit 的作者

git - "simple"vs "current"push.default in git for decentralized workflow

git - 如何传递文件名参数 gitconfig diff textconv?