IDM PowerTips

Block/line mode merge differences

UltraCompare Professional features a powerful set of merge options which give you total control over the differences between your compared files. Merging differences is a simple process and can be done with the click of a button. UltraCompare Professional will save you hours with its powerful and intuitive features for file comparison and merge.

UltraCompare Block and Line Mode Merge

Step 1: Load your files into UltraCompare

UltraCompare Professional’s interface allows you to load files with a click of a button. Once you select your two files from the explorer window, UltraCompare Professional will automatically load, compare, and display the differences between the two files. For this example, we are comparing and merging two HTML files.

merge1

UltraCompare will highlight your differences in blocks. Select the block difference you’d like to merge from one file to the other by clicking the highlighted block difference.

Step 2: Execute the merge command

After you’ve selected the difference block you’d like to merge, you can access the merge options through the Merge menu. Selecting “Merge First to Second,” as shown below, will merge your selected block difference from the left file to the right file.

git-context-menu

Step 3: Line Mode Merge

UltraCompare allows you to merge single lines as well as entire difference blocks. To enable line mode merge, go to the Merge menu and select “Line Mode Merge”.

git-context-menu

Once you’ve enabled line mode merge, you can then select the line you’d like to merge and the line you’d like to merge to. By default, UltraCompare Professional will display the contents of the selected line in both files, but you can select different lines to merge to/from.

Step 4: Merge from second to first

UltraCompare allows you to merge from your first file (on the left) to your second file (on the right), or vice versa. To merge from right to left, click the “Merge Second to First” option in the Merge menu. Since we are still in line mode merge, only the single line will be merged to the first file while the remainder of the difference block remains unchanged.

git-context-menu

Step 5: Merge in 3-way Text Mode

UltraCompare Professional allows you to use its powerful merge options while in 3-way Text Mode. To enable 3-way Text Mode, navigate to the Mode menu and select this option from the menu.

You can now use the merge options you’ve used in 2-way Text Mode with three different files.

git-context-menu

Step 6: Advanced Merge Options

UltraCompare Professional includes some advanced merge options that allow you to position the placement of your merge. For this example, we’ve opened a third HTML file that includes the tag at the top of the file. We’d like to merge this into the first two files as well. This can be done without overwriting the code on the first two files’ lines using the advanced merge options.

You can use either the merge options in the Merge menu, or the shortcut icons on the merge toolbar. In the following example, we’ve used the icon shortcut on the toolbar. We would like to insert the code into the same line as the opening tag in the first two files, as well as preserve that tag. We will do this by selecting “Merge Second to First (before)” from the Advanced Merge Options. We will do this in block merge mode so all lines of the selected block will be merged.

git

As you can see in the below screenshot, if the middle file matches the first file but not the third, the difference matching will fade towards the file it matches.

git

Our second and third files are now the same on the first line, but the first file still needs the <doctype!>code added to the beginning of the file. We can add this to our first file by selecting the first line in the first file and then clicking the “Merge Second to First (before)” button. 

git

We’ve now merged a line from our third file across two separate files.

git

Merge Undo Options

UltraCompare Professional also allows you to undo your merge changes. These undo options are located on the merge toolbar as well as in the Merge menu. “Merge Undo” will undo your last merge, and “Undo All Changes” will revert the files in the comparison window back to their saved state.

git