Resolving merge content conflicts as KeepYours / AutoMerge


I get this question, fairly often "I just merged from Trunk -> Branch, resolved all conflicts and checked in. I now merge from Branch -> Trunk, and there are no changes in trunk, so I expect no conflicts, but I get conflicts - why?". The short answer is you will get conflicts on any files you had conflicts on in the merge from Trunk -> Branch and resolved as KeepYours  or AutoMerge. The reason for this is that different branches have different purposes, so a resolution of a conflict in 1 direction, doesn't automatically imply the same resolution in the reverse direction. Consider the following scenario:

























































CS


Change


Comment


 


CS


Change


Comment


Development


 


Servicing


10


Add


Added file


 


 


 


 


 


 


 


=>


20


Branch


From Development


30


Edit


Fixed Bug 1 + refactored code


 


 


 


 


 


 


 


 


40


Edit


Fixed bug 2


 


 


 


=>


50


Merge, Edit


Merge from Development, discarded refactoring took bug fix


 In changeset 50, you accepted a bug fix from Development, but discarded a refactoring which was not needed for servicing. Now you want to push back change 40 to the Development branch. In this case, you don't want to blindly accept the Servicing version of the file, hence we present you with the opportunity to choose content coming back to Development. TFS mechanism of doing this is filing a conflict. The same reasoning  is applied for the KeepYours case.


Hope that helps explain things, when you do hit this scenario.


Cheers,


Chandru


 


Comments (0)

Skip to main content