summaryrefslogtreecommitdiffstats
path: root/man1/git-difftool.1
blob: a9018748a3e9a450aa0ed6417c4c1c839bb49cbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
'\" t
.\"     Title: git-difftool
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024-04-24
.\"    Manual: Git Manual
.\"    Source: Git 2.45.0.rc1.1.g9f32d8da7a
.\"  Language: English
.\"
.TH "GIT\-DIFFTOOL" "1" "2024\-04\-24" "Git 2\&.45\&.0\&.rc1\&.1\&.g9f" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-difftool \- Show changes using common diff tools
.SH "SYNOPSIS"
.sp
.nf
\fIgit difftool\fR [<options>] [<commit> [<commit>]] [\-\-] [<path>\&...]
.fi
.sp
.SH "DESCRIPTION"
.sp
\fIgit difftool\fR is a Git command that allows you to compare and edit files between revisions using common diff tools\&. \fIgit difftool\fR is a frontend to \fIgit diff\fR and accepts the same options and arguments\&. See \fBgit-diff\fR(1)\&.
.SH "OPTIONS"
.PP
\-d, \-\-dir\-diff
.RS 4
Copy the modified files to a temporary location and perform a directory diff on them\&. This mode never prompts before launching the diff tool\&.
.RE
.PP
\-y, \-\-no\-prompt
.RS 4
Do not prompt before launching a diff tool\&.
.RE
.PP
\-\-prompt
.RS 4
Prompt before each invocation of the diff tool\&. This is the default behaviour; the option is provided to override any configuration settings\&.
.RE
.PP
\-\-rotate\-to=<file>
.RS 4
Start showing the diff for the given path, the paths before it will move to the end and output\&.
.RE
.PP
\-\-skip\-to=<file>
.RS 4
Start showing the diff for the given path, skipping all the paths before it\&.
.RE
.PP
\-t <tool>, \-\-tool=<tool>
.RS 4
Use the diff tool specified by <tool>\&. Valid values include emerge, kompare, meld, and vimdiff\&. Run
\fBgit difftool \-\-tool\-help\fR
for the list of valid <tool> settings\&.
.sp
If a diff tool is not specified,
\fIgit difftool\fR
will use the configuration variable
\fBdiff\&.tool\fR\&. If the configuration variable
\fBdiff\&.tool\fR
is not set,
\fIgit difftool\fR
will pick a suitable default\&.
.sp
You can explicitly provide a full path to the tool by setting the configuration variable
\fBdifftool\&.<tool>\&.path\fR\&. For example, you can configure the absolute path to kdiff3 by setting
\fBdifftool\&.kdiff3\&.path\fR\&. Otherwise,
\fIgit difftool\fR
assumes the tool is available in PATH\&.
.sp
Instead of running one of the known diff tools,
\fIgit difftool\fR
can be customized to run an alternative program by specifying the command line to invoke in a configuration variable
\fBdifftool\&.<tool>\&.cmd\fR\&.
.sp
When
\fIgit difftool\fR
is invoked with this tool (either through the
\fB\-t\fR
or
\fB\-\-tool\fR
option or the
\fBdiff\&.tool\fR
configuration variable) the configured command line will be invoked with the following variables available:
\fB$LOCAL\fR
is set to the name of the temporary file containing the contents of the diff pre\-image and
\fB$REMOTE\fR
is set to the name of the temporary file containing the contents of the diff post\-image\&.
\fB$MERGED\fR
is the name of the file which is being compared\&.
\fB$BASE\fR
is provided for compatibility with custom merge tool commands and has the same value as
\fB$MERGED\fR\&.
.RE
.PP
\-\-tool\-help
.RS 4
Print a list of diff tools that may be used with
\fB\-\-tool\fR\&.
.RE
.PP
\-\-[no\-]symlinks
.RS 4
\fIgit difftool\fR\*(Aqs default behavior is to create symlinks to the working tree when run in
\fB\-\-dir\-diff\fR
mode and the right\-hand side of the comparison yields the same content as the file in the working tree\&.
.sp
Specifying
\fB\-\-no\-symlinks\fR
instructs
\fIgit difftool\fR
to create copies instead\&.
\fB\-\-no\-symlinks\fR
is the default on Windows\&.
.RE
.PP
\-x <command>, \-\-extcmd=<command>
.RS 4
Specify a custom command for viewing diffs\&.
\fIgit\-difftool\fR
ignores the configured defaults and runs
\fB<command> $LOCAL $REMOTE\fR
when this option is specified\&. Additionally,
\fB$BASE\fR
is set in the environment\&.
.RE
.PP
\-g, \-\-[no\-]gui
.RS 4
When
\fIgit\-difftool\fR
is invoked with the
\fB\-g\fR
or
\fB\-\-gui\fR
option the default diff tool will be read from the configured
\fBdiff\&.guitool\fR
variable instead of
\fBdiff\&.tool\fR\&. This may be selected automatically using the configuration variable
\fBdifftool\&.guiDefault\fR\&. The
\fB\-\-no\-gui\fR
option can be used to override these settings\&. If
\fBdiff\&.guitool\fR
is not set, we will fallback in the order of
\fBmerge\&.guitool\fR,
\fBdiff\&.tool\fR,
\fBmerge\&.tool\fR
until a tool is found\&.
.RE
.PP
\-\-[no\-]trust\-exit\-code
.RS 4
Errors reported by the diff tool are ignored by default\&. Use
\fB\-\-trust\-exit\-code\fR
to make
\fIgit\-difftool\fR
exit when an invoked diff tool returns a non\-zero exit code\&.
.sp
\fIgit\-difftool\fR
will forward the exit code of the invoked tool when
\fB\-\-trust\-exit\-code\fR
is used\&.
.RE
.sp
See \fBgit-diff\fR(1) for the full list of supported options\&.
.SH "CONFIGURATION"
.sp
\fIgit difftool\fR falls back to \fIgit mergetool\fR config variables when the difftool equivalents have not been defined\&.
.sp
Everything above this line in this section isn\(cqt included from the \fBgit-config\fR(1) documentation\&. The content that follows is the same as what\(cqs found there:
.PP
diff\&.tool
.RS 4
Controls which diff tool is used by
\fBgit-difftool\fR(1)\&. This variable overrides the value configured in
\fBmerge\&.tool\fR\&. The list below shows the valid built\-in values\&. Any other value is treated as a custom diff tool and requires that a corresponding difftool\&.<tool>\&.cmd variable is defined\&.
.RE
.PP
diff\&.guitool
.RS 4
Controls which diff tool is used by
\fBgit-difftool\fR(1)
when the \-g/\-\-gui flag is specified\&. This variable overrides the value configured in
\fBmerge\&.guitool\fR\&. The list below shows the valid built\-in values\&. Any other value is treated as a custom diff tool and requires that a corresponding difftool\&.<guitool>\&.cmd variable is defined\&.
.RE
.PP
difftool\&.<tool>\&.cmd
.RS 4
Specify the command to invoke the specified diff tool\&. The specified command is evaluated in shell with the following variables available:
\fILOCAL\fR
is set to the name of the temporary file containing the contents of the diff pre\-image and
\fIREMOTE\fR
is set to the name of the temporary file containing the contents of the diff post\-image\&.
.sp
See the
\fB\-\-tool=<tool>\fR
option in
\fBgit-difftool\fR(1)
for more details\&.
.RE
.PP
difftool\&.<tool>\&.path
.RS 4
Override the path for the given tool\&. This is useful in case your tool is not in the PATH\&.
.RE
.PP
difftool\&.trustExitCode
.RS 4
Exit difftool if the invoked diff tool returns a non\-zero exit status\&.
.sp
See the
\fB\-\-trust\-exit\-code\fR
option in
\fBgit-difftool\fR(1)
for more details\&.
.RE
.PP
difftool\&.prompt
.RS 4
Prompt before each invocation of the diff tool\&.
.RE
.PP
difftool\&.guiDefault
.RS 4
Set
\fBtrue\fR
to use the
\fBdiff\&.guitool\fR
by default (equivalent to specifying the
\fB\-\-gui\fR
argument), or
\fBauto\fR
to select
\fBdiff\&.guitool\fR
or
\fBdiff\&.tool\fR
depending on the presence of a
\fBDISPLAY\fR
environment variable value\&. The default is
\fBfalse\fR, where the
\fB\-\-gui\fR
argument must be provided explicitly for the
\fBdiff\&.guitool\fR
to be used\&.
.RE
.SH "SEE ALSO"
.PP
\fBgit-diff\fR(1)
.RS 4
Show changes between commits, commit and working tree, etc
.RE
.PP
\fBgit-mergetool\fR(1)
.RS 4
Run merge conflict resolution tools to resolve merge conflicts
.RE
.PP
\fBgit-config\fR(1)
.RS 4
Get and set repository or global options
.RE
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite