Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Merge Conflicts by Selecting Lines from Both?

I'm learning the use of version control (with Tortoise HG) so this question might be very basic, but I can't figure out how to solve it.

Suppose Branch A has a text file with the following:

A
B
C
D
E
F

Branch B has the same text file with:

A
B
3
4
E
F

When merging these two files with TortoiseHG, the merges are resolved with KDiff. Kdiff allows us to Select Lines from only one of the two. I want the Merged Code to contain lines from both like:

A
B
C
D
3
4
E
F

The order is not important. How do I solve the merge conflict in KDiff3 to get what I want?

This isn't an academic discussion. It is a simplified version of what is happening with code for a small Android application, where the XML files for Strings is edited in both Branches.

like image 864
Devdatta Tengshe Avatar asked Jun 28 '13 09:06

Devdatta Tengshe


1 Answers

Actually quite simple, in kdiff3 you turn off the auto-advance, the button after the A B C set, then you go through the conflicts using the next conflict button, (immediately before A), and on each conflict you toggle A or B or A then B or B then A to get the desired result - you can even manually edit the file in the bottom pane if necessary.

like image 97
Steve Barnes Avatar answered Oct 21 '22 09:10

Steve Barnes