0

I am having some confusion with resolving merge conflicts. It seems that my local code reflects changes I made and in other places changes that my colleague(s) have made- all before I've actually merged.

The very small image below simply demonstrates the environment of the conflict resolution tool:

  • LHS: Source: src/.../AdminController.cs;Remote
  • RHS: Target: src/.../AdminController.cs;Local

enter image description here [Figure 1]

Example 1

Here is my local code before I've resolved conflicts and merged:

enter image description here

[Figure 2]

and here is a snippet from the conflict resolution tool:

enter image description here [Figure 3]

This makes sense. I've removed the Braintree using statement and so the changes are reflected on the right as expected.

Example 2

Here is my local code before I've resolved conflicts and merged:

enter image description here [Figure 4]

and here is a snippet from the conflict resolution tool:

enter image description here [Figure 5]

This does not make sense to me. My local code in Figure 4 on line 775 reads var currentUserLicenses yet in the conflict resolution tool as seen in Figure 5, it shows that my local code (on the right) is vm.HasCurrentLicense while the remote code (on the left) is var currentUserLicenses.

What am I misunderstanding? Why is that in Figures 2 and 3, my local code was identical but in figures 4 and 5, my local code is not?

8protons
  • 3,591
  • 5
  • 32
  • 67
  • I don't know anything about the resolution tool you're using, but a proper tool should show you *three* input versions: base, local/`--ours`, and remote/other/`--theirs`. (These three inputs must reduce to one final output, which might or might not be in a fourth window or pane or some such.) – torek Feb 01 '18 at 17:33

1 Answers1

1

The confusion starts with the thought that conflict resolution occurs "before the merge". It actually occurs as one of the last steps of the merge, after all non-conflicting changes have been applied.

So the "target" window in your merge tool is not showing you "your local version" from before the merge. It's showing you the tentative merge result - "I got this far, but these last few changes overlap, so you need to clarify the result".

Personally I don't like any of the GUI-based merge tools I've used, because they have a hard time clearly showing me "you changed this, they changed this, the tentative result is this". With the textual mark-up that gits default merge driver puts in the file where a conflict occurred, I'm able to pretty quickly infer what I need to know about the four relevant versions (base, theirs, ours, tentative merge). Now that's just what works for me; what tool gives you the information in a way you understand is for you to determine. But I really would encourage you to find out how to see more than "source" and "target", because I feel information is being left out when you are given two views with those names.

Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52