0

I ran git diff between files with same name but with different branches. And I got this diff:

enter image description here

I do not understand the diff. They look the same to me. This is at the last line of the file. What is the difference here? Both files do not have newline at the end.

  • 2
    Are there any whitespace changes between the lines? Are you positive both commits do not have newlines at the end of the file? https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file – pkamb Sep 11 '20 at 08:33
  • 2
    "*Both files do not have newline at the end.*". No, one has and the other doesn't, so the difference. – phd Sep 11 '20 at 08:41
  • More specifically, the old version of the file ends with the close square bracket and newline, and the new version of the file ends with the close square bracket but no newline. The `\ No newline at end of file` line comes right after whichever file *doesn't* have the final newline. – torek Sep 11 '20 at 08:48
  • You guys are correct the old one had a new line. The new one didn't. I got confused by the +] and -].. If you guys post your comments as an answer, I'll accept it. – Subhankar Halder Sep 11 '20 at 09:06
  • 2
    Better to mark it as a dupe: [No newline at end of file](https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file) – pkamb Sep 11 '20 at 09:09
  • Don't think its a duplicate. The other question asks what's the issue with "No newline at the end of file". My question is I couldn't understand the diff itself.. – Subhankar Halder Sep 11 '20 at 09:13

0 Answers0