DEV Community

Discussion on: ๐Ÿ™ Please Add .gitattributes To Your Git Repository

Collapse
 
jessekphillips profile image
Jesse Phillips

Git should force all committed files to use lf stop entertaining the idea windows choice has any merit.

Collapse
 
deadlybyte profile image
Carl Saunders

Yep, fully agree. I'm a Windows user and always set the eof to lf no matter what.

Collapse
 
tiguchi profile image
Thomas Werner

Those line ending characters used to be control characters for teletypewriters (TTY). CR (carriage return) would tell the device to move the carriage (or print head or whatever) back to the beginning of the current line. Another LF (line feed) control character was necessary for moving the paper to the next line. It was not really a Windows choice or invention. Windows got it from MS-DOS to stay backwards-compatible and MS-DOS got it from CP/M, an OS from the 1970ies, and overall this is how TTYs worked. They needed CR and LF for doing the right thing.

The makers of Unix on the other hand decided that LF would be enough to tell a device driver to send the correct control sequence for moving to the beginning of the next line.

So in the olden days CRLF was a safer choice to control a teletypewriter.

AFAIK CRLF is still the full control sequence that is internally used by modern consoles and terminal emulators for moving the text cursor on the screen to the beginning of the next line. Hitting the Enter key produces just the CR control character. The terminal software automatically adds an LF to it

Collapse
 
jessekphillips profile image
Jesse Phillips

I realize this, and until recently both were needed for notepad to show new lines.

My point is we don't feed this to tty and when we do it is already worked out because recourse is no constrained.