【问题标题】:What is the best git config set up when you are using Linux and Windows?当您使用 Linux 和 Windows 时,最好的 git config 设置是什么?
【发布时间】: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 设置?

提前致谢。

【问题讨论】:

    标签: linux git windows-7


    【解决方案1】:

    正如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

    【讨论】:

    • +1 - 我知道对此有很多建议,但我也总是将core.autocrlf 设置为false,并确保您只使用足以应对的工具具有不同的行尾(VonC 在第一个链接答案中提出的观点)
    • 但是当你 git diff 时这个设置会给出一个 ^M,不是吗?
    • @shin:对于在 Windows 上编写的文件和在 Windows 上完成的 diff,我在 diff 期间从未见过 ^M
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-17
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多