]>
Commit | Line | Data |
---|---|---|
c4b4a5af TT |
1 | git-mergetool(1) |
2 | ================ | |
3 | ||
4 | NAME | |
5 | ---- | |
6 | git-mergetool - Run merge conflict resolution tools to resolve merge conflicts | |
7 | ||
8 | SYNOPSIS | |
9 | -------- | |
7791a1d9 | 10 | [verse] |
0460ed2c | 11 | 'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [<file>...] |
c4b4a5af TT |
12 | |
13 | DESCRIPTION | |
14 | ----------- | |
15 | ||
bbdfbc4b | 16 | Use `git mergetool` to run one of several merge utilities to resolve |
0b444cdb | 17 | merge conflicts. It is typically run after 'git merge'. |
c4b4a5af TT |
18 | |
19 | If one or more <file> parameters are given, the merge tool program will | |
3e8e691a JM |
20 | be run to resolve differences on each file (skipping those without |
21 | conflicts). Specifying a directory will include all unresolved files in | |
22 | that path. If no <file> names are specified, 'git mergetool' will run | |
23 | the merge tool program on every file with merge conflicts. | |
c4b4a5af TT |
24 | |
25 | OPTIONS | |
26 | ------- | |
6b89d068 MH |
27 | -t <tool>:: |
28 | --tool=<tool>:: | |
c4b4a5af | 29 | Use the merge resolution program specified by <tool>. |
109859e2 JH |
30 | Valid values include emerge, gvimdiff, kdiff3, |
31 | meld, vimdiff, and tortoisemerge. Run `git mergetool --tool-help` | |
32 | for the list of valid <tool> settings. | |
e15b484f | 33 | + |
0b444cdb | 34 | If a merge resolution program is not specified, 'git mergetool' |
bbdfbc4b | 35 | will use the configuration variable `merge.tool`. If the |
0b444cdb | 36 | configuration variable `merge.tool` is not set, 'git mergetool' |
e15b484f | 37 | will pick a suitable default. |
e3fa2c76 SP |
38 | + |
39 | You can explicitly provide a full path to the tool by setting the | |
bbdfbc4b | 40 | configuration variable `mergetool.<tool>.path`. For example, you |
e3fa2c76 | 41 | can configure the absolute path to kdiff3 by setting |
0b444cdb | 42 | `mergetool.kdiff3.path`. Otherwise, 'git mergetool' assumes the |
bbdfbc4b | 43 | tool is available in PATH. |
caa99829 | 44 | + |
29b802aa | 45 | Instead of running one of the known merge tool programs, |
0b444cdb | 46 | 'git mergetool' can be customized to run an alternative program |
1168d402 | 47 | by specifying the command line to invoke in a configuration |
caa99829 CB |
48 | variable `mergetool.<tool>.cmd`. |
49 | + | |
0b444cdb | 50 | When 'git mergetool' is invoked with this tool (either through the |
caa99829 CB |
51 | `-t` or `--tool` option or the `merge.tool` configuration |
52 | variable) the configured command line will be invoked with `$BASE` | |
53 | set to the name of a temporary file containing the common base for | |
54 | the merge, if available; `$LOCAL` set to the name of a temporary | |
55 | file containing the contents of the file on the current branch; | |
56 | `$REMOTE` set to the name of a temporary file containing the | |
57 | contents of the file to be merged, and `$MERGED` set to the name | |
58 | of the file to which the merge tool should write the result of the | |
59 | merge resolution. | |
60 | + | |
61 | If the custom merge tool correctly indicates the success of a | |
29b802aa | 62 | merge resolution with its exit code, then the configuration |
caa99829 | 63 | variable `mergetool.<tool>.trustExitCode` can be set to `true`. |
0b444cdb | 64 | Otherwise, 'git mergetool' will prompt the user to indicate the |
caa99829 | 65 | success of the resolution after the custom tool has exited. |
c4b4a5af | 66 | |
7a30747f DA |
67 | --tool-help:: |
68 | Print a list of merge tools that may be used with `--tool`. | |
69 | ||
6b89d068 MH |
70 | -y:: |
71 | --no-prompt:: | |
682b451f CB |
72 | Don't prompt before each invocation of the merge resolution |
73 | program. | |
c15bb0ca JH |
74 | This is the default if the merge resolution program is |
75 | explicitly specified with the `--tool` option or with the | |
76 | `merge.tool` configuration variable. | |
682b451f CB |
77 | |
78 | --prompt:: | |
c15bb0ca JH |
79 | Prompt before each invocation of the merge resolution program |
80 | to give the user a chance to skip the path. | |
682b451f | 81 | |
063f2bdb DL |
82 | -g:: |
83 | --gui:: | |
84 | When 'git-mergetool' is invoked with the `-g` or `--gui` option | |
85 | the default merge tool will be read from the configured | |
60aced3d DL |
86 | `merge.guitool` variable instead of `merge.tool`. If |
87 | `merge.guitool` is not set, we will fallback to the tool | |
88 | configured under `merge.tool`. | |
063f2bdb DL |
89 | |
90 | --no-gui:: | |
91 | This overrides a previous `-g` or `--gui` setting and reads the | |
92 | default merge tool will be read from the configured `merge.tool` | |
93 | variable. | |
94 | ||
654311bf DA |
95 | -O<orderfile>:: |
96 | Process files in the order specified in the | |
97 | <orderfile>, which has one shell glob pattern per line. | |
98 | This overrides the `diff.orderFile` configuration variable | |
99 | (see linkgit:git-config[1]). To cancel `diff.orderFile`, | |
100 | use `-O/dev/null`. | |
57937f70 | 101 | |
53204061 JN |
102 | CONFIGURATION |
103 | ------------- | |
7b5cf8be | 104 | :git-mergetool: 1 |
18d89fe2 ÆAB |
105 | |
106 | include::includes/cmd-config-section-all.txt[] | |
107 | ||
53204061 JN |
108 | include::config/mergetool.txt[] |
109 | ||
d1cc4621 DA |
110 | TEMPORARY FILES |
111 | --------------- | |
112 | `git mergetool` creates `*.orig` backup files while resolving merges. | |
113 | These are safe to remove once a file has been merged and its | |
114 | `git mergetool` session has completed. | |
115 | ||
116 | Setting the `mergetool.keepBackup` configuration variable to `false` | |
117 | causes `git mergetool` to automatically remove the backup as files | |
118 | are successfully merged. | |
119 | ||
7b5cf8be FR |
120 | BACKEND SPECIFIC HINTS |
121 | ---------------------- | |
122 | ||
123 | vimdiff | |
124 | ~~~~~~~ | |
125 | include::mergetools/vimdiff.txt[] | |
126 | ||
c4b4a5af TT |
127 | GIT |
128 | --- | |
9e1f0a85 | 129 | Part of the linkgit:git[1] suite |