如何避免git-apply改变行尾 [英] how to avoid git-apply changing line endings
问题描述
我有一个使用 core.eol = crlf
, core.autocrlf = true
和 core.safecrlf = true
。
当我从另一个 crlf
repo和我的回购,受影响文件的所有行结束都改为 lf
。目前我正在使用这个补丁:
git apply --ignore-whitespace mychanges.patch
code>
(看起来我必须使用 - ignore-whitespace
来获取)
我目前的工作是在文件上运行 unix2dos
。有没有更好的方法让申请符合我的eol设置?
I have a git repo set with core.eol=crlf
, core.autocrlf=true
and core.safecrlf=true
.
When I apply a patch from another crlf
repo and to my repo all the line endings for the effected file are changed to lf
. Currently I'm applying the patch as so:
git apply --ignore-whitespace mychanges.patch
(It seems I have to use --ignore-whitespace
to get the patch to successfully apply.)
My current work around is to run unix2dos
on the file. Is there a better way of getting apply to conform to my eol settings?
I would not allow my source control system to control my line endings. Auto crlf is false and showing diffs without the annoying ^M is done by setting core.whitespace to cr-at-eol. Now diff output will be nicer to read.
这篇关于如何避免git-apply改变行尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!