blob: b9e20c5dcd8c52df8e0782bc5d92e3a5ac5361b2 [file] [log] [blame]
Junio C Hamano103ad7f2007-03-14 11:19:261git-mergetool(1)
2================
3
4NAME
5----
6git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
7
8SYNOPSIS
9--------
Junio C Hamano15567bc2011-07-23 00:51:5910[verse]
Junio C Hamano3d1b5a12013-05-17 23:34:0211'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
Junio C Hamano103ad7f2007-03-14 11:19:2612
13DESCRIPTION
14-----------
15
Junio C Hamanobb343172008-03-09 10:39:0916Use `git mergetool` to run one of several merge utilities to resolve
Junio C Hamano1aa40d22010-01-21 17:46:4317merge conflicts. It is typically run after 'git merge'.
Junio C Hamano103ad7f2007-03-14 11:19:2618
19If one or more <file> parameters are given, the merge tool program will
Junio C Hamano33be8212023-10-23 21:45:5420be run to resolve differences in each file (skipping those without
Junio C Hamano58700662011-10-10 23:42:2721conflicts). Specifying a directory will include all unresolved files in
22that path. If no <file> names are specified, 'git mergetool' will run
23the merge tool program on every file with merge conflicts.
Junio C Hamano103ad7f2007-03-14 11:19:2624
25OPTIONS
26-------
Junio C Hamanobd53dbf2009-01-18 18:26:3727-t <tool>::
28--tool=<tool>::
Junio C Hamano103ad7f2007-03-14 11:19:2629Use the merge resolution program specified by <tool>.
Junio C Hamano28a85be2012-07-24 22:05:1530Valid values include emerge, gvimdiff, kdiff3,
31meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help`
32for the list of valid <tool> settings.
Junio C Hamano3aa81822007-03-30 08:52:2633+
Junio C Hamano1aa40d22010-01-21 17:46:4334If a merge resolution program is not specified, 'git mergetool'
Junio C Hamanobb343172008-03-09 10:39:0935will use the configuration variable `merge.tool`. If the
Junio C Hamano1aa40d22010-01-21 17:46:4336configuration variable `merge.tool` is not set, 'git mergetool'
Junio C Hamano3aa81822007-03-30 08:52:2637will pick a suitable default.
Junio C Hamano1c708832007-11-02 02:47:5038+
39You can explicitly provide a full path to the tool by setting the
Junio C Hamanobb343172008-03-09 10:39:0940configuration variable `mergetool.<tool>.path`. For example, you
Junio C Hamano1c708832007-11-02 02:47:5041can configure the absolute path to kdiff3 by setting
Junio C Hamano1aa40d22010-01-21 17:46:4342`mergetool.kdiff3.path`. Otherwise, 'git mergetool' assumes the
Junio C Hamanobb343172008-03-09 10:39:0943tool is available in PATH.
44+
Junio C Hamanoec87f522008-12-10 08:35:2545Instead of running one of the known merge tool programs,
Junio C Hamano1aa40d22010-01-21 17:46:4346'git mergetool' can be customized to run an alternative program
Junio C Hamanocb1c44f2008-08-06 06:19:3347by specifying the command line to invoke in a configuration
Junio C Hamanobb343172008-03-09 10:39:0948variable `mergetool.<tool>.cmd`.
49+
Junio C Hamano1aa40d22010-01-21 17:46:4350When 'git mergetool' is invoked with this tool (either through the
Junio C Hamanobb343172008-03-09 10:39:0951`-t` or `--tool` option or the `merge.tool` configuration
Junio C Hamano33be8212023-10-23 21:45:5452variable), the configured command line will be invoked with `$BASE`
Junio C Hamanobb343172008-03-09 10:39:0953set to the name of a temporary file containing the common base for
54the merge, if available; `$LOCAL` set to the name of a temporary
55file containing the contents of the file on the current branch;
56`$REMOTE` set to the name of a temporary file containing the
57contents of the file to be merged, and `$MERGED` set to the name
58of the file to which the merge tool should write the result of the
59merge resolution.
60+
61If the custom merge tool correctly indicates the success of a
Junio C Hamanoec87f522008-12-10 08:35:2562merge resolution with its exit code, then the configuration
Junio C Hamanobb343172008-03-09 10:39:0963variable `mergetool.<tool>.trustExitCode` can be set to `true`.
Junio C Hamano1aa40d22010-01-21 17:46:4364Otherwise, 'git mergetool' will prompt the user to indicate the
Junio C Hamanobb343172008-03-09 10:39:0965success of the resolution after the custom tool has exited.
Junio C Hamano103ad7f2007-03-14 11:19:2666
Junio C Hamanoa00504d2012-08-27 21:11:2367--tool-help::
68Print a list of merge tools that may be used with `--tool`.
69
Junio C Hamanobd53dbf2009-01-18 18:26:3770-y::
71--no-prompt::
Junio C Hamano10b7a342009-01-01 22:05:1772Don't prompt before each invocation of the merge resolution
73program.
Junio C Hamanob051caf2014-06-03 22:15:1374This is the default if the merge resolution program is
75explicitly specified with the `--tool` option or with the
76`merge.tool` configuration variable.
Junio C Hamano10b7a342009-01-01 22:05:1777
78--prompt::
Junio C Hamanob051caf2014-06-03 22:15:1379Prompt before each invocation of the merge resolution program
80to give the user a chance to skip the path.
Junio C Hamano10b7a342009-01-01 22:05:1781
Junio C Hamano94d00a52018-10-30 07:34:4082-g::
83--gui::
Junio C Hamano33be8212023-10-23 21:45:5484When 'git-mergetool' is invoked with the `-g` or `--gui` option,
Junio C Hamano94d00a52018-10-30 07:34:4085the default merge tool will be read from the configured
Junio C Hamano56d696e2019-05-19 09:01:1986`merge.guitool` variable instead of `merge.tool`. If
87`merge.guitool` is not set, we will fallback to the tool
Junio C Hamano4304bf62023-04-18 04:55:3588configured under `merge.tool`. This may be autoselected using
89the configuration variable `mergetool.guiDefault`.
Junio C Hamano94d00a52018-10-30 07:34:4090
91--no-gui::
Junio C Hamano4304bf62023-04-18 04:55:3592This overrides a previous `-g` or `--gui` setting or
93`mergetool.guiDefault` configuration and reads the default merge
94tool from the configured `merge.tool` variable.
Junio C Hamano94d00a52018-10-30 07:34:4095
Junio C Hamanoc0859f72016-10-17 22:22:5796-O<orderfile>::
97Process files in the order specified in the
98<orderfile>, which has one shell glob pattern per line.
99This overrides the `diff.orderFile` configuration variable
100(see linkgit:git-config[1]). To cancel `diff.orderFile`,
101use `-O/dev/null`.
102
Junio C Hamano3692c012021-03-17 22:56:15103CONFIGURATION
104-------------
Junio C Hamano84d4cc02022-05-11 00:55:58105:git-mergetool: 1
Junio C Hamanoba8baee2022-09-14 20:25:23106
107include::includes/cmd-config-section-all.txt[]
108
Junio C Hamano3692c012021-03-17 22:56:15109include::config/mergetool.txt[]
110
Junio C Hamanoafabd322010-07-19 20:26:15111TEMPORARY FILES
112---------------
113`git mergetool` creates `*.orig` backup files while resolving merges.
114These are safe to remove once a file has been merged and its
115`git mergetool` session has completed.
116
117Setting the `mergetool.keepBackup` configuration variable to `false`
Junio C Hamano33be8212023-10-23 21:45:54118causes `git mergetool` to automatically remove the backup files as files
Junio C Hamanoafabd322010-07-19 20:26:15119are successfully merged.
120
Junio C Hamano84d4cc02022-05-11 00:55:58121BACKEND SPECIFIC HINTS
122----------------------
123
124vimdiff
125~~~~~~~
126include::mergetools/vimdiff.txt[]
127
Junio C Hamano103ad7f2007-03-14 11:19:26128GIT
129---
Junio C Hamanof7c042d2008-06-06 22:50:53130Part of the linkgit:git[1] suite