Home > Merge (Mac) > Documentation Contents > Command Line Reference

Command Line Reference

Merge provides several command line tools that enable you to launch Merge from a variety of applications. The AppleScript API enables even greater control over Merge.

Compare command line utility

The primary (and recommended) way to use Merge from the command line is to use the Compare command line utility (compare). This utility program uses AppleScript to launch file comparisons within a new or existing instance of Merge.

Before using compare, ensure that the command-line utilities have been installed as described in the Installing the Merge command-line utilities section of the Installing from the Araxis Website page.

Usage

compare [-? | -h] [-[no]wait] [-merge] [-testconflicts] [-readonly] [-aN] [-swap] [-max] [[-titleN:"<NthFileTitle>"]...] [-2 | -3] <firstFile> <secondFile> [<thirdFile>] [<mergedOutputFile>]

For two-way comparisons, two filename arguments should be specified. These are the files that will be displayed within the file comparison window. An optional third filename argument can also be specified. This third argument is used as the default save filename if you save changes to either of the files in the file comparison window (for example, by choosing Save or Save As... from the context menu that appears when a file panel is right-clicked).

For three-way comparisons, three filename arguments should be specified. It is important that the common ancestor or base file (if any) is displayed in the middle file panel. This can be specified with the -aN command line option. As with two-way comparisons, a further optional argument can be specified to set the default filename name used if a file is saved.

When merging three files, it is easiest to merge changes from the left and right files into the middle file. This is why the common ancestor file should be displayed in the middle file panel. Once the changes have been merged into the common ancestor file, right click the middle file panel and choose Save or Save As... to save the merged file.

The command line arguments are described below.

Examples

compare file1.txt file2.txt

Opens a file comparison window comparing the two specified files.

compare -wait file1.txt file2.txt

Opens a file comparison window comparing the two specified files. Compare will not exit until the user closes the file comparison window.

compare -wait file1.txt file2.txt /tmp/merged.txt

Opens a file comparison window comparing the first two specified files. If the user attempts to save changes to either of the two files, /tmp/merged.txt will be used as the default save file name. Compare will not exit until the user closes the file comparison window.

compare -wait -a1 -3 /tmp/file1.txt /tmp/file2.txt /tmp/file3.txt

Opens a file comparison window comparing the three specified files. Compare will not exit until the user closes the file comparison window. The first file specified is treated as the common ancestor of the other two and is therefore displayed in the middle file panel.

compare -wait -a3 -3 -title1:"Djn’s Revision" /title2:"Jrs’s Revision" /title3:"Common Ancestor" /tmp/file1.txt /tmp/file2.txt /tmp/file3.txt /tmp/merged.txt

Opens a file comparison window comparing the first three specified files. If the user attempts to save changes to either of the three files, /tmp/merged.txt will be used as the default save file name. Compare will not exit until the user closes the file comparison window. The third file specified is treated as the common ancestor of the other two and is therefore displayed in the middle file panel. The file panels are given meaningful names.

araxisp4diff

This utility can be used to enable the Perforce command line utility (p4) and Perforce Visual Client (p4v) to use Araxis Merge to compare files. It can also be used as a simpler replacement for the compare utility.

Usage

araxisp4diff [-? | -h] <firstFile> <secondFile>

To use araxisp4diff with the Perforce command line tools, set the P4DIFF environment variable to reference araxisp4diff. For example, add the following line to your ~/.profile file:

export P4DIFF='/Applications/Araxis Merge/Utilities/araxisp4diff'

Since Araxis Merge is capable of comparing binary and image files, you should generally include the -t option when using the p4 diff command. For example, p4 diff -t.

araxisp4winmrg

This utility can be used to enable the Perforce command line utility (p4) and UI (p4v) to use Araxis Merge to merge files.

Usage

araxisp4winmrg [-? | -h] <ancestorFile> <theirFile> <yourFile> <saveFile>

To use araxisp4winmrg with the Perforce command line tools, set the P4MERGE environment variable to reference araxisp4winmrg. For example, add the following line to your ~/.profile file:

export P4MERGE='/Applications/Araxis Merge/Utilities/araxisp4winmrg'

araxissvndiff

This utility can be used to enable the Subversion command line utility (svn) to use Araxis Merge to compare files.

Usage

araxissvndiff [-? | -h] <firstTitle> <secondTitle> <firstFile> <secondFile>

To use araxissvndiff with the Subversion command line tools, edit your ~/.subversion/config so that the diff-cmd property in the [helpers] section references araxissvndiff. For example:

diff-cmd = /Applications/Araxis\ Merge/Utilities/araxissvndiff

This line is commented-out in the default configuration file, so you should remove the # character and space at the start if present.

araxissvndiff3

This utility can be used to enable the Subversion command line utility (svn) to use Araxis Merge to merge files.

Usage

araxissvndiff3 [-? | -h] <mineTitle> <olderTitle> <yoursTitle> <mineFile> <olderFile> <yoursFile>

To use araxissvndiff3 with the Subversion command line tools, edit your ~/.subversion/config so that the diff3-cmd property in the [helpers] section references araxissvndiff3. For example:

diff3-cmd = /Applications/Araxis\ Merge/Utilities/araxissvndiff3

This line is commented-out in the default configuration file, so you should remove the # character and space at the start if present.