Does GIT does the CRLF/LF conversion during commit or checkout(vi)?

前提是你 提交于 2019-12-08 03:08:20

问题


I have a doubt now, does Git does the CRLF conversion during a commit or during a vi of the file?

Let’s say I have some files in Windows with CRLF (not a Git repo), when I sync these files to a UNIX Git repo and do git add/commit with autocrlf true enabled, will these files get the conversion from CRLF to LF?

Or does it do the conversion of these files only when I vi these files and commit it again?


The second doubt is, what should be the autocrlf and safecrlf setting in both Unix and Windows Git clones if my parent repository exists in Unix and need LF alone. Should I use global setting?

Thanks in advance


回答1:


As mentionned in issue 449:

svn:eol-style (just like core.autocrlf) is a mechanism that happens on checkout and commit.

As for the value of that setting, on both sides (Windows/Unix), I always set it to false (in a global setting), as jleedev comments on your question.
Same for safecrl.



来源:https://stackoverflow.com/questions/3888098/does-git-does-the-crlf-lf-conversion-during-commit-or-checkoutvi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!