开发者

git autocrlf input does convert line-endings but from LF to CRLF?

git config --global core.autocrlf input

according to this github help page this should configure git so it converts all line-endings to LF when committing.

Yet when commiting to my repo this is the ou开发者_C百科tput i get.

> 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(-)

I then checked my config to see if the autocrlf option was correctly set and it was.

> git config -l | grep "crlf"
core.autocrlf=input

Why does git say that it is converting my LF to CRLF and not the other way around which is what i'm looking for?

And why does it complain 3 times? Is it because it found 3 occurrences that will be replaced? Why does it warn me one time after outputting the commithash then?

I'm confused (and on a Mac for the record :))


After a long time with dealing with line endings, I simply won't allow any tooling, including VCS change them on me.

I now use autocrlf false and core.whitespace cr-at-eol. This gets rid of the nasty ^M in diff output. This is just a highlighting addition that git does to show you creepy things like extra whitespace at the end of a line or just before a tab, etc.

Hopefully you can do the same and be done with line ending madness forever too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜