What does this warning actually mean?
CR and LF are a special set of characters that helps format our code.
CR (/r) puts the cursor at the beginning of a line but doesn’t create a new line. This is how macOS works.
LF (/n) creates a new line, but it doesn’t put the cursor at the beginning of that line. The cursor stays back at the end of the last line. This is how Unix and Linux work.
CRLF (/r/f) creates a new line as well as puts the cursor at the beginning of the new line. This is how we see it in Windows OS.
LF (LINE FEED)
- stands for Line Feed
- denoted with /n
- creates a new line in the code
- The ASCII code is 10.
- Used by Unix and other OSes based around it.
CR (CARRIAGE RETURN)
- stands for CARRIAGE RETURN
- denoted with /r
- puts the cursor on the beginning of a line.
- The ASCII code is 13.
- Used by macOS and its predecessors.
CRLF (CARRIAGE RETURN AND LINE FEED)
- stands for CARRIAGE RETURN and LINE FEED
- denoted with /n/r
- creates a new line and puts the cursor at the beginning of that new line.
- The ASCII code is 10 for LF and 13 for CR.
- Primarily used on Windows OS.
it uses LF by default. So when we use Git on Windows, it throws a warning like- “CRLF will be replaced by LF” and automatically converts all CRLF into LF, so that code becomes compatible.
PS: Don’t worry…see this less as a warning and more as a informative message.