To make a new line there is an invisible character or characters at the end of the line.
In windows it's two characters a "carriage return" (\r) and a "line feed" (\n) in most every other operating system it's just a "line feed". This why sometimes if you open a document in notepad on Windows that you created in, for instance, MacOS, all the text will be on a single line and it will look messed up.
Anyway, git is smart and it knows about how windows and MacOS etc show new lines. To make sure the code looks correct on any operating system it can turn your CRLF on windows into a LF on MacOS or the going the other way, a LF will turn into a CRLF. But needs to be told that is what it should do. If you would like more information about how to change and set that up look here: docs.github.com/en/github/using-gi...
Wow this was super clear! Thanks so much I understand it so much better now.
Only puzzling thing is that I was only using a Mac so not sure why this error happened as I would only have line feed spacing right? Will probably do a bit more googling around it but thanks again! Super helpful 🤩
Probably something to do with getting source code from a windows computer at some point I would guess? In essence likely some developer worked on windows and then it messed up some line endings for a particular file or files. So now git is telling you about it even on MacOS
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
To make a new line there is an invisible character or characters at the end of the line.
In windows it's two characters a "carriage return" (\r) and a "line feed" (\n) in most every other operating system it's just a "line feed". This why sometimes if you open a document in notepad on Windows that you created in, for instance, MacOS, all the text will be on a single line and it will look messed up.
Anyway, git is smart and it knows about how windows and MacOS etc show new lines. To make sure the code looks correct on any operating system it can turn your CRLF on windows into a LF on MacOS or the going the other way, a LF will turn into a CRLF. But needs to be told that is what it should do. If you would like more information about how to change and set that up look here: docs.github.com/en/github/using-gi...
More in depth reading can be found here: en.wikipedia.org/wiki/Newline#Issu... about newlines.
Wow this was super clear! Thanks so much I understand it so much better now.
Only puzzling thing is that I was only using a Mac so not sure why this error happened as I would only have line feed spacing right? Will probably do a bit more googling around it but thanks again! Super helpful 🤩
Probably something to do with getting source code from a windows computer at some point I would guess? In essence likely some developer worked on windows and then it messed up some line endings for a particular file or files. So now git is telling you about it even on MacOS