Three-Way File Comparison and Merging

ExpandedToggleIcon(9x12)        Regular Three-Way Comparison

Code Compare provides the functionality of three-way comparison and merge. It allows you to compare and merge three files side-by-side. All the comparison, editing and merging features of two-way file comparison apply to three-way comparison too.

In case of a three-way comparison, the latest version of a file is considered to be the result and is displayed in the middle comparison pane. Besides, during a regular three-way comparison (without the base file), at first the left pane is compared with the middle pane, and then the right pane is compared with the middle pane.

To compare three files at the same time, you can call Code Compare using Windows Explorer (right-click on a file and choose Compare with Code Compare). Another way of file selection is a dragging files to Code Compare.

Conflicts

Conflicts are cases when it is unclear whose change should be merged, e.g. if the same block of code was changed by two users, and thus they require more thorough analysis. Conflicts occur only in three-way comparisons.

In the document area conflicts are displayed framed and linked in red.

To navigate between conflicts, in the Changes menu select the Next/Previous Conflict options, or use the corresponding buttons on the toolbar.

Layout

By default, during three-way comparison files are displayed in three panes aligned side-by-side vertically. The default display of comparison panes can be changed: you can either display panes horizontally or hide one of them. This can be done using the Layout menu or toolbar options. For more information on layout commands, see the Layout Commands topic.

ExpandedToggleIcon(9x12)        Integration with Version Control Systems

Three-way file merging allows you to merge two derived files to a result or a base file.

When integrated with a version control system, Code Compare gains more features in terms of three-way comparison. In case of VCS integration not three, but four files can be compared, then the middle pane displays either the result, or the base file depending on revision selected using the Base/Result buttons.

Revision Name

Icon

Description

Mine

Mine

Just edited revision

Theirs

Theirs

Revision edited by another user

Result

Result

New revision that contains changes from 'Mine', 'Theirs', and 'Base' revisions

Base

Base

Original version of document. You can switch to this version using special button on the Code Compare toolbar. Read more about this switching in the Layout Commands topic.

This merge is the most reliable and has performed well in practice. It has also required the least amount of user intervention, and in many cases, requiring no intervention at all (depending upon the complexity of the merge) making the process eligible for task automation.

The revision version is placed on the top-left corner of the comparison pane.

threewaymerge

For details on VCS integration, refer to the Version Control Systems Integration section.

note Note

This functionality is available only in Code Compare Pro.

ExpandedToggleIcon(9x12)        Manipulating Code Merging

To manipulate code merging, use the Code Merging toolbar shown below.

code-merging-toolbar

Command Name

Icon

Description

Accept Result

Accept-Result

Accept merge result.

Theirs as Result

Theirs-Result

Regard Theirs revision as a result.

Mine as Result

Mine-Result

Regard Mine revision as a result.

Base as Result

Base-Result

Regard  Base revision as a result.

Next Conflict

Next-Conflict

Go to next conflict.

Previous Conflict

Previous-Conflict

Go to previous conflict.

Show Base File

show-base-file-icon

Show  Base file instead of Result file.

ExpandedToggleIcon(9x12)        See Also