Merging And The Merge Output Editor Window



The merge output editor window (below the diff input windows) also has an info line at the top showing "Output:", the filename and "[Modified]" if you edited something. Usually it will contain some text through the automatic merge facilities, but often it will also contain conflicts.

!!! Saving is disabled until all conflicts are resolved !!! (Use the "Go to prev/next unsolved conflicts"-buttons to find the remaining conflicts.)

With only two input files every difference is also a conflict that must be solved manually.

With three input files the first file is treated as base, while the second and third input files contain modifications. When at any line only either input B or input C have changed but not both then the changed source will automatically be selected. Only when B and C have changed on the same lines, then the tool detects a conflict that must be solved manually. When B and C are the same, but not the same as A, then C is selected.

The merge output editor window also has a summary column on the left. It shows the letter of the input from which a line was selected or nothing if all three sources where equal on a line. For conflicts it shows a questionmark "?" and the line shows "<Merge Conflict>", all in red. Because solving conflicts line by line would take very long, the lines are grouped into groups that have the same difference and conflict characteristics. But only-white-space-conflicts are separated from non-white-space-conflicts in order to ease the merging of files were the indentation changed for many lines.

When clicking into the summary column with the left mouse button in either window then the group belonging to that line will be selected in all windows and the beginning of that group will be shown. (This might involve an automatic position jump in the windows if the beginning of a group is not visible.) This group then becomes the "current group". It is highlighted with the "Current range (diff) background color" and a black bar appears on the left side of the text.

Note the input selector buttons containing the letters "A", "B" and "C" in the button bar below the menu bar. When clicking on either input selector button, the lines from that input will be added at the end of the selected group if that group didn't contain that source before. Otherwise the lines from that input will be removed.

Besides, you can directly edit any line. The summary column will show "m" for every line that was modified.

Sometimes, when a line is removed either by automatic merge or by editing and no other lines remain in that group, then the text <No src line> will appear in that line. This is just a placeholder for the group for when you might change your mind and select some source again. This text won't appear in the saved file or in any selections you want to copy and paste.

The text "<Merge Conflict>" will appear in the clipboard if you copy and paste some text containing such a line. But still be careful to do so.

The normal merge will start by solving simple conflicts automatically. But the "Merge"-menu provides some actions for other common needs. If you have to select the same source for most conflicts, then you can choose "A", "B" or "C" everywhere, or only for the remaining unsolved conflicts, or for unsolved whitespace conflicts. If you want to decide every single delta yourself, you can "Set deltas to conflicts". Or if you want to return to the automatic choices of KDiff3 then select "Automatically solve simple conflicts". KDiff3 then restarts the merge. For actions that change your previous modifications KDiff3 will ask for your confirmation before proceeding.

Note: When choosing either source for unsolved whitespace conflicts and the options "Ignore Numbers" or "Ignore C/C++ Comments" are used then changes in numbers or comments will be treated like whitespace too.