Does GIT does the CRLF/LF conversion during commit

2019-05-23 02:00发布

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条回答
我只想做你的唯一
2楼-- · 2019-05-23 02:44

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.

查看更多
登录 后发表回答