【发布时间】:2011-05-21 12:08:16
【问题描述】:
我对 git config 的 core.eol、core.autocrlf、core.safecrlf 有点困惑。
http://git-scm.com/docs/git-config
我正在使用 Ubuntu 和寡妇。
我之前有过 ^M 和其他问题。
谁能为这个问题推荐最好的 git config 设置?
提前致谢。
【问题讨论】:
我对 git config 的 core.eol、core.autocrlf、core.safecrlf 有点困惑。
http://git-scm.com/docs/git-config
我正在使用 Ubuntu 和寡妇。
我之前有过 ^M 和其他问题。
谁能为这个问题推荐最好的 git config 设置?
提前致谢。
【问题讨论】:
正如Git on Windows (msysgit) - Unix or DOS line termination 中所述,我会使用:
git config --system core.autocrlf false
这将避免任何自动 eol 转换(有关此选项值的确切含义,请参阅“Git on Windows: What do the crlf settings mean?”)。
您可以将其保留为 true,如 git replacing LF with CRLF 中所述,但我更喜欢设置 core.eol + 一些 gitattribute 文件,以便微调我想要 eol 更改的一些文件。
详情请见this answer。
【讨论】:
core.autocrlf 设置为false,并确保您只使用足以应对的工具具有不同的行尾(VonC 在第一个链接答案中提出的观点)
^M。