VS Team Explorer merge conflicts
Asked Answered
M

2

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

Machellemachete answered 28/11, 2017 at 9:4 Comment(0)
R
30

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

Resign answered 28/11, 2017 at 11:43 Comment(4)
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.Waneta
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).Waneta
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'.Waneta
Hopefully Microsoft will enhance it in feature: developercommunity.visualstudio.com/idea/502400/…Caprine
I
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!

Insula answered 5/1, 2021 at 13:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.