Search code examples
gitvisual-studio-2015

Unnecessary Extra new line in Visual Studio - Merge Conflict


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


Solution

  • 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.