I am using Windows and PHPStorm IDE for web development. In Git Bash, when I want to add (git add .
) or commit
- there would be hundreds of warnings like this:
warning: LF will be replaced by CRLF in ...
The file will have its original line endings in your working directory.
But if I do the following in Git Bash:
git config --global core.autocrlf false
No more of these warnings. Is there any risk or disadvantage of setting core.autocrlf
to false
? Or I should not worry? As I already wrote, I am working with web apps (php files, html files, css... that will be later pushed to some remote rep. on GitHub or copied to a production Linux server...). Sorry for my bad English.
In short, it shouldn't make a difference.
Under Windows, the standard line ending format is a carriage return character followed by a line feed character (CRLF
for short), whereas in the Unix world, only the line feed character is used (LF
for short). This is what your git
is warning you about - that it wants to change the type of line ending in the file it commits, even if it doesn't change in your local working directory.
Most Unix systems can recognize CRLF
line endings fine, but Windows text editors occasionally have issues with Unix-style line endings (Notepad being the most notable example). Since git
is converting away from Unix-style, you should be fine. Even if it weren't, you would likely be fine, as most developer-y text editors in the Windows world can deal with Unix-style line endings.
Obviously, if your codebase includes some kind of hand-rolled code generator (or something in that vein) that relies on specific line ending types in its inputs, this may go out the window a little. But, if you have such a generator, it's probably a safe assumption to say that you likely know the risks/issues associated with differing line ending styles.