Merge text comparisons make it possible for you to compare and merge text files, or text that you type into Merge. You can copy and paste text into Merge from other applications, or directly open and compare the text from Microsoft Office, OpenDocument, PDF and RTF files. Merge can apply special formatting to XML and XHTML files (see below), helping you to see changes more clearly.
You can open a new text comparison window by selecting the New Text Comparison command in the File menu. You may have multiple comparison windows open at the same time.
Two empty areas where the compared files will be displayed take up the majority of the window. You can type directly into each file pane, or paste text copied from other applications. Alternatively, above each file pane is an entry field that you can use to enter the path to a file that you want to compare.
Specifying the files to compare
To compare two text files, you can type the paths of two files into the entry fields or use the buttons on the right-hand end of the entry fields to choose files to compare.
The button opens a file-browsing sheet and the button displays a list of files that you have recently compared.
Click the button in the toolbar or press the Enter key when you have chosen two files to compare.
You can also drag and drop files from Finder onto the filename entry fields or onto the file panes.
As well as files on the local disk and network volumes, Merge is also able to directly access and compare files stored within Perforce, Subversion, and (local clones of) Mercurial and Git repositories. See Virtual File System (VFS) Plugins for more details.
Accessing other revisions of a file with the Versions button
If there are other versions of the file named in the entry field available for comparison, the button displays a list of these other versions. You can open the same file in both the left and right comparison panes, then use this button to compare a file with an earlier revision of itself.
If enabled on the Preferences… > Application > Versions page, Merge is able to find other versions of a file from the following sources:
Time Machine. Merge automatically searches the currently configured Time Machine backup disk to find any older versions of the file you are comparing. If the Time Machine disk is a network volume, Merge will endeavour to mount it.
Time Machine backups will not occur while a Time Machine password-protected network volume is mounted by Merge. To allow Time Machine to make backups to the volume, eject the Time Machine network volume using Finder.
Perforce, Subversion, Mercurial, and Git repositories. Merge endeavours to find any older versions of the file you are comparing from the relevant Perforce, Subversion, Mercurial, or Git repository. If a Perforce, Subversion, Mercurial, or Git URI has been specified in the filename entry field, Merge will search the repository from which it loaded the file for any other revisions. Otherwise, if a file has been loaded from the local disk or a network volume and is part of a client workspace, Merge will search the relevant repository for which credentials have been supplied on the Credentials preference page.
Unicode/MBCS and other character encodings
Merge can compare files encoded with Unicode, mbcs and other character encodings as well as ascii files. Merge can compare files even if they were saved with different encodings. Please see Working with Character Encodings for more information.
Merge comes with a number of filters that can automatically extract the text content from certain common types of files when they are loaded. This means, for example, that you can drag and drop a pair of Microsoft Word documents onto a Merge text comparison window and have the text comparison automatically extract and compare the text from those documents.
Merge includes text extraction filters for files from the following applications:
Microsoft Word 97 and later (.doc and .docx)
Microsoft Excel 97 and later (.xls and .xlsx)
Microsoft PowerPoint 97 and later (.ppt)
OpenDocument text, spreadsheet and presentation files (that is, Writer, Calc and Impress documents) from OpenOffice.org and NeoOffice (.odt, .ods, .odp)
Unencrypted Adobe PDF files (.pdf)
Rich Text Files (.rtf)
HTML files (.html, .htm)
These filters are all optional and not all of them are enabled by default. Thus, you can compare HTML and RTF files as they are, without conversion. Likewise, you might prefer to compare PDF files using an image comparison. The File Types preference page can be used to configure which filters Merge uses and what sort of comparison is started for different file types.
When comparing text documents, it is usually helpful to have Merge wrap long lines of text, breaking them at word boundaries. You can choose this behaviour from the Display preference page.
Note that Merge can extract text, but not formatting, from the above file formats. Merge is not therefore able to show you formatting differences. The text filters for these file formats are also one-way – text can be extracted from these types of files, but not written to them. Please also be aware that the filters have various other limitations. They do not, for example, extract bullet and paragraph numbering information from Microsoft Word files, and password-protected documents are unsupported. For some documents, it might therefore be preferable to open them in their native application and copy and paste text from them into a text comparison pane. This will have the benefit of preserving details such as bullet and paragraph numbering.
Finally, be aware that you can use these filters to compare documents of different types. For example, perhaps a client has sent you a PDF of a final version of a contract, created from a Microsoft Word document that you had previously reviewed. You can use Merge to compare the text content of the PDF and Word documents to be sure that they are the same.
Merge comes with filter (plistFilter) to convert Mac .plist files into XML text. This means that you can compare and modify binary .plist files using a Merge text comparison. When you save the .plist file, Merge will use the filter to turn the XML back into a binary .plist file.
Merge also comes with a filter (otoolFilter) to convert Mac binary executable files into (potentially) more meaningful text. This filter is one-way – you can’t save changes to an executable file.
Neither of these filters is enabled by default. To enable them, visit the File Types preference page.
The Format menu contains commands to reformat XML and XHTML files, enabling them to be compared more easily. Reformatting affects the appearance and layout of the compared files on-screen and how they are compared. However, it does not change the content of the files: whitespace is not added or removed, neither is content re-ordered. This means that you can see changes clearly in even the most densely formatted XML files without sacrificing the fidelity of a true textual comparison. Reformatted files can be edited, merged, and saved as usual.
You can use the File Types preference page to enable or disable the automatic reformatting of XML and XHTML files when they are opened in a new text comparison window.
When comparing re-formatted XML and XHTML files, it can be helpful to check the Show CR and LF characters option on the Display preference page. This will help you identify line breaks that are present in the original text files.
The file comparison display
Two sample text files (test1.txt and test2.txt) are provided in Sample Files folder on the Merge installation disk image. The following screenshot shows the results of a file comparison between these two files.
Changes between the two files are highlighted with colours and linking lines. Linking lines in the centre panel of the file comparison window connect related changes to show exactly how the files are related. You can modify the colours and fonts used in the file comparison window by using the controls in the Fonts/Colours preferences page.
A summary of the number of removals, insertions and changes that were found between the compared files is shown in the status bar at the bottom of the main Merge application window. The current line and column number for the editing caret is also displayed.
A disclosure button at the bottom-left corner of the comparison window can be used to reveal a panel showing the current lines from the text panels above, one above another. Whitespace and end-of-line characters are always shown in this panel.
You can use the n-Way Comparison (Side-By-Side) and n-Way Comparison (Stacked) commands in the Window menu to change the layout of the files within the file comparison window so that the compared files are displayed one above the other (stacked) or side-by-side (the default).
There are many options that you can set to customize how Merge compares and displays files. There are help topics that will enable you learn how to customize Merge so that it produces the best results for you.
As you scroll one file up and down using its scroll bar, the other file is scrolled so that the two files remain aligned in the centre of the display. The centre point marker (a line of small indentations in the centre of the linking lines panel) indicates the point at which Merge tries to keep related parts of the files aligned. You can temporarily prevent Merge from keeping both files aligned by holding down the Ctrl+Cmd keys while scrolling. When you release Ctrl+Cmd, the files will snap back into alignment.
The small Previous Change and Next Change buttons below the scroll bars can be used to jump to the previous or next change.
There are thin overview strips next to the vertical scroll bars at the left and right edges of the file comparison window. These contain markings to indicate the position of changes within the compared files. You can quickly navigate to a change by clicking on the marks in the strip.
You can use the cursor keys to navigate within a file after clicking within it to give it keyboard focus. The following navigation shortcut keys are also available:
Cmd+< moves the editing cursor to the previous change.
Cmd+> moves the editing cursor to the next change.
Option+Left and Option+Right move the editing cursor left and right in word steps.
Home and End move the editing cursor to the beginning or end of the file.
Cmd+L displays a window that you can use to navigate to a specific line number.
For a full list of keyboard shortcuts, see Keyboard Shortcuts.
If your mouse has a wheel, you can use it to scroll up and down within the active file.
Searching for text
You can search for text in the active file by pressing Cmd+F or selecting the Find… command from the Edit menu.
Bookmarks and comments
As you are comparing or editing files, you might want to set bookmarks to enable you to return to locations of interest later on. Press Ctrl+F2 to toggle a bookmark on or off on the current line. To navigate between bookmarks, press F2 or Shift+F2.
Comments can be added to bookmarks, making it easy to note important information or to record a question. To edit a bookmark’s comment, right-click the bookmark and choose the Edit Comment menu item. Bookmark comments are shown as tooltips when you hover the mouse pointer over a bookmark.
Bookmarks and comments are included when you save a comparison for archival or team collaboration. Bookmark comments are also shown in HTML comparison reports. They are therefore a useful tool for asking questions or making notes in a comparison that will later be emailed to other team members for review.
Three-way file comparisons
In addition to two-way file comparison, the Professional Edition of Merge enables you compare (and, for text files, merge) three files. Please see the Three-Way File Comparisons topic for more information.
As well as the comparison features described above, Merge enables you to edit and merge the files being compared. Please see the Editing Files topic for more information.
Merge provides syntax colouring support for a variety of programming languages:
|C/C++/Obj-C||.c .cc .cpp .cxx .h .hh .hpp .hxx .sma .m .mm|
|Windows resources||.rc .rc2 .dlg|
|Flash||.as .asc .jsfl|
|VB||.vb .bas .frm .cls .ctl .pag .dsr .dob|
|Pascal/Delphi||.dpr .dpk .pas .dfm .inc .pp|
|HTML/XML/PHP/VXML||.html .htm .asp .shtml .htd .php3 .phtml .php .htt .cfm .tpl .dtd .hta .vxml .xml .xsl .xslt .svg .xul .xsd .dtd .axl .xrc .rdf .vcproj .wxs .wxi .docbook|
|Caml/OCaml/F#/SML||.caml .ml .mli .fs .fsi|
|Fortran||.f90 .f95 .f2k .f .for|
|Lisp||.lsp .lisp .csm .smd .ss|
|Perl||.pl .pm .cgi .pod|
|Python||.py .pyw SConstruct SConscript|
|Visual DataFlex (using the Smalltalk parser)||.src .pkg|
|SQL||.sql .spec .body .sps .spb .sf .sp|
Syntax highlighting can be enabled (and colours configured) using the controls in the Syntax Highlighting preferences page. File extensions and keywords for each language can be changed by editing the highlight.styles file in the Merge installation directory.