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 output 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With