Three-way merge


Apart from offering its comprehensive comparison features, Code Compare is an advanced visual 3-way merge tool. In other words, it allows you to compare and merge three files at once. Such functionality makes Code Compare incredibly useful in case when a project developed by several people at once. Three-way merge supports the same features you use to compare and merge two files. However, it provides to you a better dimensional picture and allows saving a huge amount of time as compared to 2-way merge.

For this reason 3-way merge is considered an advanced functionality and is therefore absent from the free Code Compare version and available to users of the extended Code Compare Pro version only.

You can add your files by choosing the respective option from Windows Explorer context menu or by simple drag-n-dropping. If you integrate Code Compare into a version control system, you will be able to launch 3-way merge from there to solve any conflicts arising.

Pane Alignment

Working with 3 files requires three panes on the comparison window. You must choose the base file and place it on the middle pane. The rest of the panes will contain two different editions of the base file, while the rest of panes are intended to contain the files to be compared with the base file.

The default view is a vertical layout with all the panes displayed side-by side.

3-way Merge - vertical layout

The comprehensive user interface of Code Compare contains a special toolbar, which allows aligning all the panes according to your preferences. A single click can switch between vertical and mixed layout, hide or show specific panes.

By clicking the Default 2-Pane View button you can switch off Three-way Merge mode and merge two files. The resulting layout will look like this:

Three-way Merge Mode

Revision versions

Each file is assigned a revision version making it even easier for you to distinguish the files you are working with. Each type can be shortened to a letter designation, displayed in the top left corner of the respective pane. There are four revision types possible:

  • Base — base file you are working with;

  • Mine — just edited revision;

  • Theirs — other user's revision;

  • Result — the resulting, new revision, containing all the changes introduced from Mine, Theirs and Base revisions.

The Show Base File button allows choosing the file to be shown on the central pane between result and base.

Having arranged the files to your liking you can go on and start merging your files. Like in 2-way merging, 3-way merge is based on single click actions. You can replace, delete and insert differences before or after the related block, comparing the base file with two of its revisions.

After the changed have been implemented and the document is closed, the following dialog appears.

3-way merge saving options

This dialog allows you to choose a result file to save your changes into. If Show this dialog only when more than one file has been modified option is selected, the dialog appears only when several files have been modified.

For details on the major feature set of our file diff and merge tool, refer to the overview page of Code Compare.