1GIT-MERGETOOL(1)                  Git Manual                  GIT-MERGETOOL(1)
2
3
4

NAME

6       git-mergetool - Run merge conflict resolution tools to resolve merge
7       conflicts
8

SYNOPSIS

10       git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
11

DESCRIPTION

13       Use git mergetool to run one of several merge utilities to resolve
14       merge conflicts. It is typically run after git merge.
15
16       If one or more <file> parameters are given, the merge tool program will
17       be run to resolve differences on each file (skipping those without
18       conflicts). Specifying a directory will include all unresolved files in
19       that path. If no <file> names are specified, git mergetool will run the
20       merge tool program on every file with merge conflicts.
21

OPTIONS

23       -t <tool>, --tool=<tool>
24           Use the merge resolution program specified by <tool>. Valid values
25           include emerge, gvimdiff, kdiff3, meld, vimdiff, and tortoisemerge.
26           Run git mergetool --tool-help for the list of valid <tool>
27           settings.
28
29           If a merge resolution program is not specified, git mergetool will
30           use the configuration variable merge.tool. If the configuration
31           variable merge.tool is not set, git mergetool will pick a suitable
32           default.
33
34           You can explicitly provide a full path to the tool by setting the
35           configuration variable mergetool.<tool>.path. For example, you can
36           configure the absolute path to kdiff3 by setting
37           mergetool.kdiff3.path. Otherwise, git mergetool assumes the tool is
38           available in PATH.
39
40           Instead of running one of the known merge tool programs, git
41           mergetool can be customized to run an alternative program by
42           specifying the command line to invoke in a configuration variable
43           mergetool.<tool>.cmd.
44
45           When git mergetool is invoked with this tool (either through the -t
46           or --tool option or the merge.tool configuration variable) the
47           configured command line will be invoked with $BASE set to the name
48           of a temporary file containing the common base for the merge, if
49           available; $LOCAL set to the name of a temporary file containing
50           the contents of the file on the current branch; $REMOTE set to the
51           name of a temporary file containing the contents of the file to be
52           merged, and $MERGED set to the name of the file to which the merge
53           tool should write the result of the merge resolution.
54
55           If the custom merge tool correctly indicates the success of a merge
56           resolution with its exit code, then the configuration variable
57           mergetool.<tool>.trustExitCode can be set to true. Otherwise, git
58           mergetool will prompt the user to indicate the success of the
59           resolution after the custom tool has exited.
60
61       --tool-help
62           Print a list of merge tools that may be used with --tool.
63
64       -y, --no-prompt
65           Don’t prompt before each invocation of the merge resolution
66           program. This is the default if the merge resolution program is
67           explicitly specified with the --tool option or with the merge.tool
68           configuration variable.
69
70       --prompt
71           Prompt before each invocation of the merge resolution program to
72           give the user a chance to skip the path.
73
74       -g, --gui
75           When git-mergetool is invoked with the -g or --gui option the
76           default merge tool will be read from the configured merge.guitool
77           variable instead of merge.tool. If merge.guitool is not set, we
78           will fallback to the tool configured under merge.tool.
79
80       --no-gui
81           This overrides a previous -g or --gui setting and reads the default
82           merge tool will be read from the configured merge.tool variable.
83
84       -O<orderfile>
85           Process files in the order specified in the <orderfile>, which has
86           one shell glob pattern per line. This overrides the diff.orderFile
87           configuration variable (see git-config(1)). To cancel
88           diff.orderFile, use -O/dev/null.
89

CONFIGURATION

91       mergetool.<tool>.path
92           Override the path for the given tool. This is useful in case your
93           tool is not in the PATH.
94
95       mergetool.<tool>.cmd
96           Specify the command to invoke the specified merge tool. The
97           specified command is evaluated in shell with the following
98           variables available: BASE is the name of a temporary file
99           containing the common base of the files to be merged, if available;
100           LOCAL is the name of a temporary file containing the contents of
101           the file on the current branch; REMOTE is the name of a temporary
102           file containing the contents of the file from the branch being
103           merged; MERGED contains the name of the file to which the merge
104           tool should write the results of a successful merge.
105
106       mergetool.<tool>.hideResolved
107           Allows the user to override the global mergetool.hideResolved value
108           for a specific tool. See mergetool.hideResolved for the full
109           description.
110
111       mergetool.<tool>.trustExitCode
112           For a custom merge command, specify whether the exit code of the
113           merge command can be used to determine whether the merge was
114           successful. If this is not set to true then the merge target file
115           timestamp is checked and the merge assumed to have been successful
116           if the file has been updated, otherwise the user is prompted to
117           indicate the success of the merge.
118
119       mergetool.meld.hasOutput
120           Older versions of meld do not support the --output option. Git will
121           attempt to detect whether meld supports --output by inspecting the
122           output of meld --help. Configuring mergetool.meld.hasOutput will
123           make Git skip these checks and use the configured value instead.
124           Setting mergetool.meld.hasOutput to true tells Git to
125           unconditionally use the --output option, and false avoids using
126           --output.
127
128       mergetool.meld.useAutoMerge
129           When the --auto-merge is given, meld will merge all non-conflicting
130           parts automatically, highlight the conflicting parts and wait for
131           user decision. Setting mergetool.meld.useAutoMerge to true tells
132           Git to unconditionally use the --auto-merge option with meld.
133           Setting this value to auto makes git detect whether --auto-merge is
134           supported and will only use --auto-merge when available. A value of
135           false avoids using --auto-merge altogether, and is the default
136           value.
137
138       mergetool.hideResolved
139           During a merge Git will automatically resolve as many conflicts as
140           possible and write the MERGED file containing conflict markers
141           around any conflicts that it cannot resolve; LOCAL and REMOTE
142           normally represent the versions of the file from before Git’s
143           conflict resolution. This flag causes LOCAL and REMOTE to be
144           overwriten so that only the unresolved conflicts are presented to
145           the merge tool. Can be configured per-tool via the
146           mergetool.<tool>.hideResolved configuration variable. Defaults to
147           false.
148
149       mergetool.keepBackup
150           After performing a merge, the original file with conflict markers
151           can be saved as a file with a .orig extension. If this variable is
152           set to false then this file is not preserved. Defaults to true
153           (i.e. keep the backup files).
154
155       mergetool.keepTemporaries
156           When invoking a custom merge tool, Git uses a set of temporary
157           files to pass to the tool. If the tool returns an error and this
158           variable is set to true, then these temporary files will be
159           preserved, otherwise they will be removed after the tool has
160           exited. Defaults to false.
161
162       mergetool.writeToTemp
163           Git writes temporary BASE, LOCAL, and REMOTE versions of
164           conflicting files in the worktree by default. Git will attempt to
165           use a temporary directory for these files when set true. Defaults
166           to false.
167
168       mergetool.prompt
169           Prompt before each invocation of the merge resolution program.
170

TEMPORARY FILES

172       git mergetool creates *.orig backup files while resolving merges. These
173       are safe to remove once a file has been merged and its git mergetool
174       session has completed.
175
176       Setting the mergetool.keepBackup configuration variable to false causes
177       git mergetool to automatically remove the backup as files are
178       successfully merged.
179

GIT

181       Part of the git(1) suite
182
183
184
185Git 2.36.1                        2022-05-05                  GIT-MERGETOOL(1)
Impressum