33

When merging our develop branch into my feature branch develop --> feature in Visual Studio, I get a merge conflict.
I have the possibility to choose from Take Source and Keep Target.

I want to take the file from the develop branch. Which one is the correct option?

enter image description here

Alex Kulinkovich
  • 4,408
  • 15
  • 46
  • 50
xeraphim
  • 4,375
  • 9
  • 54
  • 102

2 Answers2

30

In this case, you should Take Source. The "Source" is the develop branch and the "Target" is the feature branch.

Edmund Dipple
  • 2,244
  • 17
  • 12
  • 36
    It's way too ambiguous in Visual Studio which is the source branch and which is the target branch. Microsoft can do better than this - I feel they should throw the branch name on there too. It's just a little too tricky. At least it all works - but the UI in all of the VS merge process could be a bit better. Lots of little UI quirks they could fix. – Kyle Vassella Dec 19 '18 at 17:20
  • 2
    For instance, when doing a merge and resolving conflicts, when you click on one side to check it out, the window auto scrolls down - for what reason I don't know - and you lose your place and have to scroll back up. Just one example of these little problems (perhaps it's by design for some reason - very annoying though). – Kyle Vassella Dec 19 '18 at 17:22
  • 2
    AND, when you do 'compare files', it gives you a nice little sidebar showing you all the red and green areas of each file. But when you click 'merge' to actually do the step through and mark a checkbox next to each change you want to keep, this helpful sidebar guide is no longer there - making it much easier to make a mistake. You have to visually scroll through the whole file and look for any green or red areas, whereas with the guide you could quickly tell 'hey - there's a green area down there, let me scroll to it'. – Kyle Vassella Dec 19 '18 at 17:26
  • Hopefully Microsoft will enhance it in feature: https://developercommunity.visualstudio.com/idea/502400/resolve-conflict-source-and-target-is-confusing.html – Ivan Salo Jan 16 '20 at 16:35
1

I found @Kyle Vassella 's comment, above, worked best for me, i.e. use the "Merge"-button. It is simple, powerful and the ambiguity of the other options can be ignored.

I first "Compared files" (or "diff'd" them) using the above UI - just to get a feel for what I was dealing with. In my case, I could have then selected the Master version for one file and the branch for the other one and all would have been fine, but I would have lost a few comment tweaks and some tidying up of the code. Clicking on "Merge" allowed me to view both versions + VisualStudio2017's best guess at what the merged file should look like - its guess was extremely good. I could have just resolved 3 or 4 minor conflicts and accepted everything else. The UI provide buttons to find the next/previous Conflict and the next/previous Change. The former are the main thing, the latter are handy for double-checking everything.

I thought VS2017 Teams GIT lacked proper interactive MERGE capability - I was wrong, once found it is actually surprisingly good and simple to use. Harummph!

Zeek2
  • 386
  • 4
  • 8