Three-Way Comparisons Print this Topic Previous Page Up One Level Next page

Home >  Comparing Files >

Three-Way Comparisons

With DiffDog, you can compare not only pairs of files, but also three files in a side-by-side manner. This kind of comparison is particularly useful to compare two files against a base copy from which both files originate. For example, let's assume that two people, Alice and Bob, created their own copies of an original file (let's call it "the common ancestor file", or "the base file"). If both Alice and Bob subsequently made edits to their copy, you can open all three files and compare them side-by-side in DiffDog.


A triple way comparison would help you display all changes made by both Alice and Bob compared to the common ancestor file, and navigate all the differences. For each encountered difference, you can decide whose change ("left", "right", or "middle") should be kept. The chevrons in the diagram above show the directions in which you can merge a particular change (for example, from Alice's file into the base file, or from the base file into Bob's file).


Importantly, it might be the case that both Alice and Bob edited the same line of text, in which case a conflict occurs. All the conflicts are identified and highlighted by DiffDog, and you can resolve them by accepting either Alice's or Bob's change into the final version. A conflict essentially means that the program cannot reasonably determine which change ("left", "middle", or "right") is the one you want to keep in the final version. To resolve the conflict, you must explicitly instruct DiffDog to merge text either from Alice's file into the base file (or the other way round), or from Bob's file into the base file (or the other way round).


Three way comparison

In the image above, the middle pane displays the common ancestor file; the left pane displays Alice's version, and the right pane display's Bob's version. After you run a three way comparison, DiffDog highlights any differences and conflicts as follows:


Differences between the "left" file and the "middle" file. For example, Alice changed line 3 which is highlighted as a change.
Differences between the "right" file and the "middle" file. For example, Bob changed line 2 which is highlighted as a change.
If any conflicts are detected between the three files, they are highlighted as well. For example, both Alice and Bob changed line 5, which is highlighted as a conflict.



To run a three-way comparison:

1.On the File menu, click Compare Files 3-way. (Alternatively, click the Toggle 2-way/3-way Comparison dd_ic_3way toolbar button. You can also select three files in Windows Explorer, right-click and select Compare with Altova DiffDog from the context menu.)
2.At the top-right corner of each comparison pane, click Open ic_open to add the required files to the comparison. You can also drag files from Windows Explorer into each of the three panes.


Note:The file into which you want to merge changes from both versions must be opened in the middle pane (because merging is possible, for example, from right to middle, or left to middle, but not from right to left, or left to right). See also Swapping Panes.


3.On the Diff and Merge menu, click Start Comparison (alternatively, click Compare ic_start-comparison or press F5). This step is not necessary if Autostart Comparison ic_autostart-comparison option is enabled.



To switch from a two-way comparison to a three-way comparison, and vice versa:

On the View menu, click Toggle 2-way/3-way Comparison (or click Toggle 2-way/3-way Comparison dd_ic_3way toolbar button). The file comparison window now includes three panes instead of two.


After you run a three-way comparison, the total number of differences and conflicts is visible at all times in the status bar. The color used by DiffDog to highlight differences and conflicts can be adjusted from Tools | DiffDog Options | File Comparison tab.


Three-way comparison works in a similar way for other file types, including XML files. Note that, with XML files, you can view the differences in the Grid View, in addition to the Text View.


Note:Three-way comparisons are not supported for Word documents or directories.


Three-way comparisons can be saved to a .filedif file and re-opened later just like two-way comparisons, see Saving and Loading Comparisons.

© 2019 Altova GmbH