📄Line Ending
Also known as Newline Character, End of Line, CRLF, LF and CRLF
The hidden character that ends a line of text. Windows uses two, Linux and macOS use one.
Think of it like
Think of it like the Enter key. Some computers press it once, and some press it twice.
Example
Lucy edits a script on Windows and runs it on a Linux server. It fails with a strange \r error until she saves it with LF endings.
Why it matters
Mixed line endings make Git show every line as changed, and they can break scripts. Teams pick one style and stick to it.
Definition
Example code
console
$ printf 'hi\r\n' | od -c
0000000 h i \r \n
0000004Common mistake
Key takeaways
- 1A hidden mark. It ends each line of text.
- 2Two styles. LF on Linux and macOS, CRLF on Windows.
- 3Pick one. Set your editor and Git to match.