Appendix B. Automating TortoiseMerge

Table of Contents

TortoiseMerge Command Line Switches

TortoiseMerge can be started with command line parameters to avoid having to go through the Open dialog to select the files yourself. This is useful also if you want to use TortoiseMerge from another application.

TortoiseMerge Command Line Switches

Most switches require additional information like a path or some other string. In those cases, append an ':' to the switch and put the string/path after it. Example:

/base:"c:\folder\my base file.txt"

Table B.1. List of available command line options

CommandDescription
/? Shows a dialog box with the most important command line switches.
/help The same as ?.
/base Specifies the base file used in three way diffs. This is the common ancestor of the files being diffed, although it is not shown in a separate window. For two way diffs, this is the left file.
/basename The name of the base file. This is shown in the view title instead of the file path. For three way diffs it is shown in a tooltip for the view title.
/theirs Specifies the theirs file used in three way diffs, displayed in the left pane.
/theirsname The name of the theirs file. This is shown in the view title instead of the file path.
/mine Specifies the mine file used in three way diffs, displayed in the right pane. For two way diffs, this is the right file.
/minename The name of the mine file. This is shown in the view title instead of the file path.
/merged Specifies the resulting merged file used in three way diffs. This is the file path where the result of the merge/conflict resolving is saved. If this is not set, then TortoiseMerge will ask the user where to save the result.
/mergedname The name of the merged file. This is shown in the view title instead of the file path.
/patchpath The path where a patch should be applied to. If you don't set this path, then TortoiseMerge will try to find the path itself to match the paths in the patch file, but that can take very long.
/patchoriginal The name of the original file to patch. Used for the view title.
/patchpatched The name of the resulting patched file. Used for the view title.
/diff The path to the patch/diff file to apply to a directory.
/oneway Forces TortoiseMerge to start with the one-way view instead of the view the user specified in the settings.
/reversedpatch Switches the left and right view of the specified two files to diff.
/createunifieddiff Creates a unified diff file (patch file) of two files specified with /origfile:"path_to_original_file" and /modifiedfile:"path_to_modified_file". The target path is set with /outfile:"path_to_resulting_patchfile". If /outfile is not set, a file save dialog is shown so the user can choose the location to save the patch file. Note: If /createunifieddiff is set, all other parameters are ignored.


You can also supply simple filenames on the command line for compatibility with other diff programs. In this simplified form the command line is

TortoiseMerge BaseFilePath MyFilePath [ TheirFilePath ]

If two files are given they will be compared with each other. If three files are given, the first is taken as the BASE file, and the other two are compared with it in a three-way diff.