1

This will be a little bit odd or foolish question.

I am using VS2015 pro.

Left Side= Main Branch

Right Side= My working branch

and when every time I perform merge to our main branch going to my working branch I am getting extra newline(image on the left side.). But the codes are the same, except for the blank lines above.

How can I eliminate this extra spaces? Do you think it has something to do with formatting/text?

Thanks!

enter image description here

Jeric Cruz
  • 1,899
  • 1
  • 14
  • 29
  • Which side is the main branch and which is your working branch? – Code-Apprentice Jul 31 '17 at 00:49
  • Main branch is on the Left side, and my working branch is on the right side.. – Jeric Cruz Jul 31 '17 at 00:53
  • So it appears that the main branch has two extra blank lines at the beginning of the file. Is that correct? – Code-Apprentice Jul 31 '17 at 00:54
  • This may be related to the different tools you're using having a disagreement about [what a text file is](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). –  Jul 31 '17 at 00:54
  • Oh, is it about the space at the top? I assumed that was just dead space above the text window, since the line below it is labeled "1". –  Jul 31 '17 at 00:55
  • yeah, all codes are identical... except for that extra space... – Jeric Cruz Jul 31 '17 at 00:56
  • @JericCruz Just to clarify, what extra space are you referring, too. – Code-Apprentice Jul 31 '17 at 01:00
  • @WumpusQ.Wumbley Now that you mention it, I think you are correct. The space at the top is an artifact of the diff visualization. Which is actually kind of strange that diff doesn't line up the identical lines and simply mark the terminating new line as the only difference. – Code-Apprentice Jul 31 '17 at 01:00
  • @Code-Apprentice I mean it was extra newline – Jeric Cruz Jul 31 '17 at 01:02
  • @JericCruz Where? I see two blank lines at the top on the left and one blank line at the bottom on the right. – Code-Apprentice Jul 31 '17 at 01:03
  • just two empty lines(on the left) are the difference of the files. the rest are identical. the space below on the right side are fine.. – Jeric Cruz Jul 31 '17 at 01:07
  • 1
    11 comments so far and we can't get you to say whether you're asking about the space at the top or the bottom –  Jul 31 '17 at 01:09
  • updated the image, that is the extra new line that am asking. I want to ask if how visual studio come up with this differences. the rest of the codes below on that space are identical – Jeric Cruz Jul 31 '17 at 01:16

1 Answers1

0

This appears to be an oddity of your diff tool. If you look closely, you will see that the "blank lines" at the top of the left side do not have any numbers. In addition, the space in the editor has diagonal hashes through it. This is simply spacing inserted by the diff visualization. This is not extra blank lines in your file. I do not understand why it does this though, since the first three lines in both files look identical and the fourth line is added in your local working copy. One reason might be if you have different line-ending settings in your local copy than is used in the main repo. You should double check whether you are using CR/NL or just NL and set your local copy to be the same as the main branch.

Also, you can check the diff with other tools, such as git diff in Git Bash or cmd.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268