我在 Windows 下使用 Git 来签入一些文件。我收到了类似的警告
LF 将被 foobar 中的 CRLF 替换
这个警告是什么意思?我可以做些什么来防止这个警告。
这可能意味着您尝试添加一个以 LF 行结尾的文件,并且您已core.autocrlf
打开。将文件转换为 CR/LF 行结尾,或关闭core.autocrlf
.
这与core.autocrlf
选项有关。手册是这样说的:
core.autocrlf
Setting this variable to "true" is almost the same as setting the
text attribute to "auto" on all files except that text files are
not guaranteed to be normalized: files that contain CRLF in the
repository will not be touched. Use this setting if you want to
have CRLF line endings in your working directory even though the
repository does not have normalized line endings. This variable can
be set to input, in which case no output conversion is performed.
Git 会警告您他为您更改了行终止符。
我建议为项目设置全局策略(如“始终使用 unix 行结束”,反之亦然)并禁用此选项。有时事情会变得混乱,提交差异然后包含许多额外的空白更改。
msysgit 默认系统配置是core.autocrlf = true
,这意味着 CRLF 转换是开启的。