1GIT-MERGETOOL(1) Git Manual GIT-MERGETOOL(1)
2
3
4
6 git-mergetool - Run merge conflict resolution tools to resolve merge
7 conflicts
8
10 git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
11
12
14 Use git mergetool to run one of several merge utilities to resolve
15 merge conflicts. It is typically run after git merge.
16
17 If one or more <file> parameters are given, the merge tool program will
18 be run to resolve differences on each file (skipping those without
19 conflicts). Specifying a directory will include all unresolved files in
20 that path. If no <file> names are specified, git mergetool will run the
21 merge tool program on every file with merge conflicts.
22
24 -t <tool>, --tool=<tool>
25 Use the merge resolution program specified by <tool>. Valid values
26 include emerge, gvimdiff, kdiff3, meld, vimdiff, and tortoisemerge.
27 Run git mergetool --tool-help for the list of valid <tool>
28 settings.
29
30 If a merge resolution program is not specified, git mergetool will
31 use the configuration variable merge.tool. If the configuration
32 variable merge.tool is not set, git mergetool will pick a suitable
33 default.
34
35 You can explicitly provide a full path to the tool by setting the
36 configuration variable mergetool.<tool>.path. For example, you can
37 configure the absolute path to kdiff3 by setting
38 mergetool.kdiff3.path. Otherwise, git mergetool assumes the tool is
39 available in PATH.
40
41 Instead of running one of the known merge tool programs, git
42 mergetool can be customized to run an alternative program by
43 specifying the command line to invoke in a configuration variable
44 mergetool.<tool>.cmd.
45
46 When git mergetool is invoked with this tool (either through the -t
47 or --tool option or the merge.tool configuration variable) the
48 configured command line will be invoked with $BASE set to the name
49 of a temporary file containing the common base for the merge, if
50 available; $LOCAL set to the name of a temporary file containing
51 the contents of the file on the current branch; $REMOTE set to the
52 name of a temporary file containing the contents of the file to be
53 merged, and $MERGED set to the name of the file to which the merge
54 tool should write the result of the merge resolution.
55
56 If the custom merge tool correctly indicates the success of a merge
57 resolution with its exit code, then the configuration variable
58 mergetool.<tool>.trustExitCode can be set to true. Otherwise, git
59 mergetool will prompt the user to indicate the success of the
60 resolution after the custom tool has exited.
61
62 --tool-help
63 Print a list of merge tools that may be used with --tool.
64
65 -y, --no-prompt
66 Don’t prompt before each invocation of the merge resolution
67 program.
68
69 --prompt
70 Prompt before each invocation of the merge resolution program. This
71 is the default behaviour; the option is provided to override any
72 configuration settings.
73
75 git mergetool creates *.orig backup files while resolving merges. These
76 are safe to remove once a file has been merged and its git mergetool
77 session has completed.
78
79 Setting the mergetool.keepBackup configuration variable to false causes
80 git mergetool to automatically remove the backup as files are
81 successfully merged.
82
84 Part of the git(1) suite
85
86
87
88Git 1.8.3.1 11/19/2018 GIT-MERGETOOL(1)