git-mergetool.txt 3.61 KB
Newer Older
1 2 3 4 5 6 7 8 9
git-mergetool(1)
================

NAME
----
git-mergetool - Run merge conflict resolution tools to resolve merge conflicts

SYNOPSIS
--------
10
[verse]
11
'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
12 13 14 15

DESCRIPTION
-----------

16
Use `git mergetool` to run one of several merge utilities to resolve
17
merge conflicts.  It is typically run after 'git merge'.
18 19

If one or more <file> parameters are given, the merge tool program will
20 21 22 23
be run to resolve differences on each file (skipping those without
conflicts).  Specifying a directory will include all unresolved files in
that path.  If no <file> names are specified, 'git mergetool' will run
the merge tool program on every file with merge conflicts.
24 25 26

OPTIONS
-------
27 28
-t <tool>::
--tool=<tool>::
29
	Use the merge resolution program specified by <tool>.
30 31 32
	Valid values include emerge, gvimdiff, kdiff3,
	meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help`
	for the list of valid <tool> settings.
33
+
34
If a merge resolution program is not specified, 'git mergetool'
35
will use the configuration variable `merge.tool`.  If the
36
configuration variable `merge.tool` is not set, 'git mergetool'
37
will pick a suitable default.
38 39
+
You can explicitly provide a full path to the tool by setting the
40
configuration variable `mergetool.<tool>.path`. For example, you
41
can configure the absolute path to kdiff3 by setting
42
`mergetool.kdiff3.path`. Otherwise, 'git mergetool' assumes the
43
tool is available in PATH.
44
+
45
Instead of running one of the known merge tool programs,
46
'git mergetool' can be customized to run an alternative program
47
by specifying the command line to invoke in a configuration
48 49
variable `mergetool.<tool>.cmd`.
+
50
When 'git mergetool' is invoked with this tool (either through the
51 52 53 54 55 56 57 58 59 60 61
`-t` or `--tool` option or the `merge.tool` configuration
variable) the configured command line will be invoked with `$BASE`
set to the name of a temporary file containing the common base for
the merge, if available; `$LOCAL` set to the name of a temporary
file containing the contents of the file on the current branch;
`$REMOTE` set to the name of a temporary file containing the
contents of the file to be merged, and `$MERGED` set to the name
of the file to which the merge tool should write the result of the
merge resolution.
+
If the custom merge tool correctly indicates the success of a
62
merge resolution with its exit code, then the configuration
63
variable `mergetool.<tool>.trustExitCode` can be set to `true`.
64
Otherwise, 'git mergetool' will prompt the user to indicate the
65
success of the resolution after the custom tool has exited.
66

67 68 69
--tool-help::
	Print a list of merge tools that may be used with `--tool`.

70 71
-y::
--no-prompt::
72 73
	Don't prompt before each invocation of the merge resolution
	program.
74 75 76
	This is the default if the merge resolution program is
	explicitly specified with the `--tool` option or with the
	`merge.tool` configuration variable.
77 78

--prompt::
79 80
	Prompt before each invocation of the merge resolution program
	to give the user a chance to skip the path.
81

82 83 84 85 86 87
-O<orderfile>::
	Process files in the order specified in the
	<orderfile>, which has one shell glob pattern per line.
	This overrides the `diff.orderFile` configuration variable
	(see linkgit:git-config[1]).  To cancel `diff.orderFile`,
	use `-O/dev/null`.
88

89 90 91 92 93 94 95 96 97 98
TEMPORARY FILES
---------------
`git mergetool` creates `*.orig` backup files while resolving merges.
These are safe to remove once a file has been merged and its
`git mergetool` session has completed.

Setting the `mergetool.keepBackup` configuration variable to `false`
causes `git mergetool` to automatically remove the backup as files
are successfully merged.

99 100
GIT
---
101
Part of the linkgit:git[1] suite