Web developing on Windows, set VS Code to LF but when I try using GIT it wants to put it back to CRLF


I’m attempting to develop on Windows. In VS Code I’ve set the EOL sequence from CRLF to LF.

Now I’m attempting to add my file to the git staging area but each time i do it I get:

$ git add .
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory

I don’t want it to be replaced. I want it to remain LF. Any help much appreciated. Am I mistranslating this message. I don’t know. Help much appreciated.


CRLF is pretty much standard, so I’m not surprised it’s going to change it for compatibility sake.

And it’s only talking about the readme. Not about any code, so I’m not sure what the issue really is.

It shows the same message with my js, php, css, python files too etc.

What do you mean standard? Microsoft standard yes but web development… LF is much more widely used.

Are you suggesting I just develop in CRLF? Confused. Thanks

Sorry. I was going based on your screenshot. My apologies.

Not my experience, but it’s one debate I’ve never understood anyway. For me, it falls right into the appropriate spacing for tabs argument. Though I get it’s a Unix/Windows thing as well.

Looks like you can turn the warning off.
Or tweak the setting in the config files.

Advantage of using CRLF is that this format is displayed correct by all operating systems and all editors because on Linux, Mac etc the ctrl is simply ignored. Other way around it’s not so easy because if you open a file with LF only in e.g. Notepad you will have no line break.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.