2 .\" Title: git-mergetool
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.34.1.182.ge773545c7f
10 .TH "GIT\-MERGETOOL" "1" "12/10/2021" "Git 2\&.34\&.1\&.182\&.ge77354" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-mergetool \- Run merge conflict resolution tools to resolve merge conflicts
35 \fIgit mergetool\fR [\-\-tool=<tool>] [\-y | \-\-[no\-]prompt] [<file>\&...]
40 Use \fBgit mergetool\fR to run one of several merge utilities to resolve merge conflicts\&. It is typically run after \fIgit merge\fR\&.
42 If one or more <file> parameters are given, the merge tool program will 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, \fIgit mergetool\fR will run the merge tool program on every file with merge conflicts\&.
45 \-t <tool>, \-\-tool=<tool>
47 Use the merge resolution program specified by <tool>\&. Valid values include emerge, gvimdiff, kdiff3, meld, vimdiff, and tortoisemerge\&. Run
48 \fBgit mergetool \-\-tool\-help\fR
49 for the list of valid <tool> settings\&.
51 If a merge resolution program is not specified,
53 will use the configuration variable
54 \fBmerge\&.tool\fR\&. If the configuration variable
58 will pick a suitable default\&.
60 You can explicitly provide a full path to the tool by setting the configuration variable
61 \fBmergetool\&.<tool>\&.path\fR\&. For example, you can configure the absolute path to kdiff3 by setting
62 \fBmergetool\&.kdiff3\&.path\fR\&. Otherwise,
64 assumes the tool is available in PATH\&.
66 Instead of running one of the known merge tool programs,
68 can be customized to run an alternative program by specifying the command line to invoke in a configuration variable
69 \fBmergetool\&.<tool>\&.cmd\fR\&.
73 is invoked with this tool (either through the
79 configuration variable) the configured command line will be invoked with
81 set to the name of a temporary file containing the common base for the merge, if available;
83 set to the name of a temporary file containing the contents of the file on the current branch;
85 set to the name of a temporary file containing the contents of the file to be merged, and
87 set to the name of the file to which the merge tool should write the result of the merge resolution\&.
89 If the custom merge tool correctly indicates the success of a merge resolution with its exit code, then the configuration variable
90 \fBmergetool\&.<tool>\&.trustExitCode\fR
92 \fBtrue\fR\&. Otherwise,
94 will prompt the user to indicate the success of the resolution after the custom tool has exited\&.
99 Print a list of merge tools that may be used with
105 Don\(cqt prompt before each invocation of the merge resolution program\&. This is the default if the merge resolution program is explicitly specified with the
109 configuration variable\&.
114 Prompt before each invocation of the merge resolution program to give the user a chance to skip the path\&.
125 option the default merge tool will be read from the configured
126 \fBmerge\&.guitool\fR
128 \fBmerge\&.tool\fR\&. If
129 \fBmerge\&.guitool\fR
130 is not set, we will fallback to the tool configured under
131 \fBmerge\&.tool\fR\&.
136 This overrides a previous
140 setting and reads the default merge tool will be read from the configured
147 Process files in the order specified in the <orderfile>, which has one shell glob pattern per line\&. This overrides the
148 \fBdiff\&.orderFile\fR
149 configuration variable (see
150 \fBgit-config\fR(1))\&. To cancel
151 \fBdiff\&.orderFile\fR, use
152 \fB\-O/dev/null\fR\&.
156 mergetool\&.<tool>\&.path
158 Override the path for the given tool\&. This is useful in case your tool is not in the PATH\&.
161 mergetool\&.<tool>\&.cmd
163 Specify the command to invoke the specified merge tool\&. The specified command is evaluated in shell with the following variables available:
165 is the name of a temporary file containing the common base of the files to be merged, if available;
167 is the name of a temporary file containing the contents of the file on the current branch;
169 is the name of a temporary file containing the contents of the file from the branch being merged;
171 contains the name of the file to which the merge tool should write the results of a successful merge\&.
174 mergetool\&.<tool>\&.hideResolved
176 Allows the user to override the global
177 \fBmergetool\&.hideResolved\fR
178 value for a specific tool\&. See
179 \fBmergetool\&.hideResolved\fR
180 for the full description\&.
183 mergetool\&.<tool>\&.trustExitCode
185 For a custom merge command, specify whether the exit code of the merge command can be used to determine whether the merge was successful\&. If this is not set to true then the merge target file timestamp is checked and the merge assumed to have been successful if the file has been updated, otherwise the user is prompted to indicate the success of the merge\&.
188 mergetool\&.meld\&.hasOutput
194 option\&. Git will attempt to detect whether
198 by inspecting the output of
199 \fBmeld \-\-help\fR\&. Configuring
200 \fBmergetool\&.meld\&.hasOutput\fR
201 will make Git skip these checks and use the configured value instead\&. Setting
202 \fBmergetool\&.meld\&.hasOutput\fR
205 tells Git to unconditionally use the
213 mergetool\&.meld\&.useAutoMerge
216 \fB\-\-auto\-merge\fR
217 is given, meld will merge all non\-conflicting parts automatically, highlight the conflicting parts and wait for user decision\&. Setting
218 \fBmergetool\&.meld\&.useAutoMerge\fR
221 tells Git to unconditionally use the
222 \fB\-\-auto\-merge\fR
224 \fBmeld\fR\&. Setting this value to
226 makes git detect whether
227 \fB\-\-auto\-merge\fR
228 is supported and will only use
229 \fB\-\-auto\-merge\fR
230 when available\&. A value of
233 \fB\-\-auto\-merge\fR
234 altogether, and is the default value\&.
237 mergetool\&.hideResolved
239 During a merge Git will automatically resolve as many conflicts as possible and write the
241 file containing conflict markers around any conflicts that it cannot resolve;
245 normally represent the versions of the file from before Git\(cqs conflict resolution\&. This flag causes
249 to be overwriten so that only the unresolved conflicts are presented to the merge tool\&. Can be configured per\-tool via the
250 \fBmergetool\&.<tool>\&.hideResolved\fR
251 configuration variable\&. Defaults to
255 mergetool\&.keepBackup
257 After performing a merge, the original file with conflict markers can be saved as a file with a
259 extension\&. If this variable is set to
261 then this file is not preserved\&. Defaults to
263 (i\&.e\&. keep the backup files)\&.
266 mergetool\&.keepTemporaries
268 When invoking a custom merge tool, Git uses a set of temporary files to pass to the tool\&. If the tool returns an error and this variable is set to
269 \fBtrue\fR, then these temporary files will be preserved, otherwise they will be removed after the tool has exited\&. Defaults to
273 mergetool\&.writeToTemp
279 versions of conflicting files in the worktree by default\&. Git will attempt to use a temporary directory for these files when set
280 \fBtrue\fR\&. Defaults to
286 Prompt before each invocation of the merge resolution program\&.
288 .SH "TEMPORARY FILES"
290 \fBgit mergetool\fR creates \fB*\&.orig\fR backup files while resolving merges\&. These are safe to remove once a file has been merged and its \fBgit mergetool\fR session has completed\&.
292 Setting the \fBmergetool\&.keepBackup\fR configuration variable to \fBfalse\fR causes \fBgit mergetool\fR to automatically remove the backup as files are successfully merged\&.
295 Part of the \fBgit\fR(1) suite