Home > PMdiff 4.7 > Tutorials > File Merging

File Merging Tutorial: Use PMdiff to Merge HTML Pages

Your colleague has made changes to a page on your company web site...and so have you. Use Araxis PMdiff to sort out the mess!

Step 1

PMdiff's visual file merging works with any text file. Use it with source code and system configuration files, as well as with HTML.

Take a look at the File Comparison Tutorial if you haven't used PMdiff before.

Start PMdiff and open the your colleague's HTML file in the left hand side of a file comparison window. This will be the base version of the HTML page.

Now open your version of the HTML page in the right hand side of the file comparison window. You will treat this as the ideal version of the HTML page - the one you wanted.

Step 2

White space in the HTML file isn’t important to the final look of the page. Click the Options button on the toolbar, and choose the Lines tab from the Options property sheet.

Picture of Lines options page

Make sure that Ignore all whitespace is selected. This tells PMdiff to ignore differences in whitespace when comparing files. Click OK to dismiss the Options property sheet.

Picture of Refresh toolbar button

Now click the Refresh toolbar button. This forces PMdiff to recompare the two HTML files, taking into account the new whitespace setting.

Step 3

Right click either file to display the context menu.

Picture of Enable Merging context menu

Make sure that Enable Merging is selected.

Step 4

Step through each change in turn (remember that you can use the double-headed arrow buttons to jump between differences).

Note the check boxes on each block of changed text.

Picture of check box on change block

If the check box is checked, the section of text in the change block will be included when you save the merged file.

Step 5

Where a block of text has been modified (rather than having been inserted or deleted), the section of text with the check mark will be saved in the merged file.

Normally, PMdiff assumes that you want at least one side of each pair of changed blocks. If you check one side, the other side will become unchecked, and vice versa.

Sometimes, however, you will want both sides of the pair to be included in the merged file. To do this, hold down Shift as you check the box. Both sides will then be checked.

Picture of both check boxes checked

You can also hold down Shift when unchecking to make sure that neither side of the change block pair is included in the merged file.

This method can be used to make sure that blocks of unchanged text are excluded from the merge.

Step 6

Selecting the blocks of text that you want included in the merged file using point-and-click is easy, and often all you need.

Picture of context menu

You can use the pop-up context menu from either file to save a merged file containing just the blocks of text that you have selected.

Note that the context menu has several options which allow you to quickly select and deselect blocks of text.

The Save Merged File dialog is displayed when you choose to save a merged file. The default filename in this dialog is that of the original left or right file, depending on whether the context menu was popped-up from the left or right file panel.

Picture of Save Merged File dialog

Notice that you can choose to save the file with each line ending with a carriage return and linefeed (CR LF). This is the usual Windows text file format. Alternatively, you can save the file with each line ending with just a linefeed (LF). This is the text format usually used on Unix systems. You can also choose to preserve the line endings used in the original text files.

Step 7

Sometimes point-and-click visual merging doesn’t give you enough control. PMdiff incorporates a built-in editor which allows you to edit a merged file after visual merging.

Start the merged file editor by clicking the Edit Merged File button on the toolbar.

Picture of Edit Merged File toolbar button

This copy of PMdiff has been configured to show text from the left file in blue, and text from the right file in red. You can choose the text colour and style used for each type of change on the Merging page of the PMdiff Options property sheet.

Picture of PMdiff post-merge editor

Step 8

Use the Previous Change and Next Change toolbar buttons on the editing window to move quickly between each of the changes between the two files.

Picture of Previous and Next Change toolbar buttons

This allows you to skip quickly over unchanged text and concentrate on the sections of the merged file that matter.

Step 9

Once you have finished editing the merged file, you are ready to save it.

Picture of editing window save buttons

The editing window has three save buttons on its toolbar. The first saves the merged file with the filename of the left file; the second saves the file with the filename of the right file.

The third button, Save As, allows you to save the merged file under a name that you specify.

Summary

You have reconciled visually every difference between the two HTML files using PMdiff's point-and-click merging.

You were able to refine the merged file using the post-merge editing window, concentrating on the changed text and skipping over irrelevant sections.

Finally, you saved the merged file with the filename of one of the original files, or under a name of your choosing.