TortoiseGitMerge Manual

Appendix B. Automating TortoiseGitMerge

TortoiseGitMerge 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 TortoiseGitMerge from another application.

TortoiseGitMerge 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.
/helpThe same as ?.
/baseSpecifies 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.
/basenameThe 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.
/basereflectednameThe name to use for editorconfig templates.
/theirsSpecifies the theirs file used in three way diffs, displayed in the left pane.
/theirsnameThe name of the theirs file. This is shown in the view title instead of the file path.
/theirsreflectednameThe name to use for editorconfig templates.
/mineSpecifies the mine file used in three way diffs, displayed in the right pane. For two way diffs, this is the right file.
/minenameThe name of the mine file. This is shown in the view title instead of the file path.
/minereflectednameThe name to use for editorconfig templates.
/mergedSpecifies 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 TortoiseGitMerge will ask the user where to save the result.
/mergednameThe name of the merged file. This is shown in the view title instead of the file path.
/mergedreflectednameThe name to use for editorconfig templates.
/patchpathThe path where a patch should be applied to. If you don't set this path, then TortoiseGitMerge will try to find the path itself to match the paths in the patch file, but that can take very long.
/saverequiredIf specified, forces TortoiseMerge to ask to save the file before exiting, even if the user does not modify the files.
/saverequiredonconflictsIf specified, forces TortoiseMerge to ask to save the file before exiting if there are conflicts found, even if the user does not modify the files.
/patchoriginalThe name of the original file to patch. Used for the view title.
/patchpatchedThe name of the resulting patched file. Used for the view title.
/diffThe path to the patch/diff file to apply to a directory.
/onewayForces TortoiseGitMerge to start with the one-way view instead of the view the user specified in the settings.
/reversedpatchSwitches the left and right view of the specified two files to diff.
/createunifieddiffCreates 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.
/lineSpecifies a line number to jump to after loading the files.
/readonlyPrevents the file from being edited. That means the editing capabilities of TortoiseGitMerge are disabled.


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

TortoiseGitMerge 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.