When doing a git diff
it says \"No newline at end of file\".
Ok, there is no newline at end of file. What\'s the big deal?
What\'s the
It's not just bad style, it can lead to unexpected behavior when using other tools on the file.
Here is test.txt
:
first line
second line
There is no newline character on the last line. Let's see how many lines are in the file:
$ wc -l test.txt
1 test.txt
Maybe that's what you want, but in most cases you'd probably expect there to be 2 lines in the file.
Also, if you wanted to combine files it may not behave the way you'd expect:
$ cat test.txt test.txt
first line
second linefirst line
second line
Finally, it would make your diffs slightly more noisy if you were to add a new line. If you added a third line, it would show an edit to the second line as well as the new addition.