我正在尝试为我们的组织制定正式的补丁工作流程。我们有一个内部项目,我们不介意空格(如果可能的话,希望对每个用户保持相同)、EOF/EOL 字符等。我们有在 Mac 和 Windows 平台上工作的开发人员。在这两个地方,我们都使用 git 和 Cygwin。
我read here core.autocrlf true 可以解决问题,或者您可以使用 --keep-cr
。
但是here VonC suggests core.autocrlf
false是一个更好的策略。
我的问题是:
- 何时使用 true,何时使用 false? (我只是不想让 git 打扰我 并且补丁应涂抹光滑)。
--keep-cr
何时引入?我使用 git 1.7.2,我的手册页没有这个选项?- 使用哪些忽略空白选项才能实现顺利的修补工作流程?
最佳答案
1.7.2 应该有 git am 的 --keep-cr
,因为它是在 commit ad2c928 中引入的。作者:Stefan-W. Hahn,包含在 Git 1.7.1 中。
when you know you are feeding output from "
git format-patch
" directly to "git am
", and especially when your contents have CR at the end of line, such stripping is undesirable. To help such a use case, teach--keep-cr
option to "git am
" and pass that to "git mailinfo
".
但是,在 Windows 上,我总是使用 latest Git For Windows release , not the cygwin one (尽管you can have both)。
core.autocrlf
is that it is a repository-wide setting 的问题这可能会影响所有文件(甚至是非文本文件)。
我更喜欢core.eol
directives .
对于空格,您可以尝试“git: patch does not apply ”:
git apply --ignore-space-change --ignore-whitespace mychanges.patch
关于git - 何时将 --keep-cr 与 am 一起使用以及它是在哪个版本的 git 中引入的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24178587/