1

I use git and try to merge two branches. I use kdiff3 to solve conflicts. I have a conflict at the same line. I want to join changes from B and C. How to do this?

mtkachenko
  • 5,389
  • 9
  • 38
  • 68
  • Actually now I really like to use notepad++ or some code editor like vs-code to resolve conflicts) Just open it, find '>>>>>' then delete wrong part or join code form both branches. – mtkachenko Oct 19 '17 at 11:18

2 Answers2

3

enter image description here

As you can see, it shows you all 4 pieces of information, BASE, LOCAL, and REMOTE on top, and the MERGE_RESULT file on the bottom. It currently has a Merge Conflict that you need to fix.

You can move from one unresolved conflict to the next using the triple up and triple-down colored arrows in the middle of the tool bar. When a conflict is highlighted, you can press any combination of the A, B, and C buttons in the toolbar. Pressing one of those buttons will resolve the conflict with the code from pane A, B, or C on top. So if the LOCAL file (your file) had the right changes in it, you’d press B.

It’s possible to press more than one button if code from multiple panes is valid. You can also directly edit the file in the MERGE_RESULT pane to make manual changes if the correct merge is not the exact text in A/B/C.

Another option, if you want to take all of the changes from one file and discard any changes from the others, is to go to the “Merge” menu and pick one of “Choose A Everywhere”, “Choose B Everywhere”, or “Choose C Everywhere”.

Once you’ve resolved your file, simply save it (cmd-S) and quit out of kdiff3. Your SCM should see the MERGE_RESULT no longer has any merge conflicts and will mark it as resolved, ready for you to commit it. If there are other files with merge conflicts, you can repeat the process with those files.

Please see the kdiff3 official documentations

Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
2

Click on both B and C buttons to accept line(s) from each.

cdmh
  • 3,294
  • 2
  • 26
  • 41