Chr*_*isR 7 git version-control github
git config --global core.autocrlf input
根据这个github帮助页面,这应该配置git,以便在提交时将所有行结尾转换为LF.
然而,当我提交我的回购时,这就是我得到的输出.
> git commit -am "test commit"
warning: LF will be replaced by CRLF in .htaccess.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .htaccess.
The file will have its original line endings in your working directory.
[release/4.2 27bad5b] test commit
warning: LF will be replaced by CRLF in .htaccess.
The file will have its original line endings in your working directory.
1 files changed, 1 insertions(+), 1 deletions(-)
Run Code Online (Sandbox Code Playgroud)
然后我检查了我的配置,看看是否正确设置了autocrlf选项.
> git config -l | grep "crlf"
core.autocrlf=input
Run Code Online (Sandbox Code Playgroud)
为什么git说它将我的LF转换为CRLF,而不是相反,我正在寻找什么?
为什么会抱怨3次?是因为它发现了3次被取代的事件?为什么在输出commithash之后它会一次警告我?
我很困惑(并在Mac上记录:))
Ada*_*ruk 13
经过很长一段时间处理行结尾,我根本不会允许任何工具,包括VCS在我身上改变它们.
我现在用autocrlf false和core.whitespace cr-at-eol.这摆脱了diff输出中令人讨厌的^ M. 这只是一个突出的补充,git会向你展示一些令人毛骨悚然的东西,比如一行末尾或者一个标签之前的额外空格等.
希望你也可以做同样的事情并完成线条结束疯狂.