]>
Commit | Line | Data |
---|---|---|
c1a95fa6 SO |
1 | // Please don't remove this comment as asciidoc behaves badly when |
2 | // the first non-empty line is ifdef/ifndef. The symptom is that | |
3 | // without this comment the <git-diff-core> attribute conditionally | |
4 | // defined below ends up being defined unconditionally. | |
5 | // Last checked with asciidoc 7.0.2. | |
6 | ||
7 | ifndef::git-format-patch[] | |
8 | ifndef::git-diff[] | |
272bd3cf | 9 | ifndef::git-log[] |
c1a95fa6 | 10 | :git-diff-core: 1 |
272bd3cf | 11 | endif::git-log[] |
c1a95fa6 SO |
12 | endif::git-diff[] |
13 | endif::git-format-patch[] | |
14 | ||
15 | ifdef::git-format-patch[] | |
16 | -p:: | |
2cfa8330 | 17 | --no-stat:: |
02bc5b03 | 18 | Generate plain patches without any diffstats. |
c1a95fa6 SO |
19 | endif::git-format-patch[] |
20 | ||
21 | ifndef::git-format-patch[] | |
dda2d79a | 22 | -p:: |
a9e67c8c | 23 | -u:: |
1c9eecff | 24 | --patch:: |
11422f23 | 25 | Generate patch (see <<generate_patch_text_with_p>>). |
d0258b93 JK |
26 | ifdef::git-diff[] |
27 | This is the default. | |
28 | endif::git-diff[] | |
dda2d79a | 29 | |
7b02c834 MM |
30 | -s:: |
31 | --no-patch:: | |
9d484b92 JH |
32 | Suppress all output from the diff machinery. Useful for |
33 | commands like `git show` that show the patch by default to | |
34 | squelch their output, or to cancel the effect of options like | |
35 | `--patch`, `--stat` earlier on the command line in an alias. | |
36 | ||
b73a1bcc | 37 | endif::git-format-patch[] |
7b02c834 | 38 | |
1d24509b | 39 | ifdef::git-log[] |
be3820c6 SO |
40 | -m:: |
41 | Show diffs for merge commits in the default format. This is | |
42 | similar to '--diff-merges=on', except `-m` will | |
43 | produce no output unless `-p` is given as well. | |
44 | ||
45 | -c:: | |
46 | Produce combined diff output for merge commits. | |
47 | Shortcut for '--diff-merges=combined -p'. | |
48 | ||
49 | --cc:: | |
50 | Produce dense combined diff output for merge commits. | |
51 | Shortcut for '--diff-merges=dense-combined -p'. | |
52 | ||
c8e5cb06 SO |
53 | --dd:: |
54 | Produce diff with respect to first parent for both merge and | |
55 | regular commits. | |
56 | Shortcut for '--diff-merges=first-parent -p'. | |
57 | ||
be3820c6 SO |
58 | --remerge-diff:: |
59 | Produce remerge-diff output for merge commits. | |
60 | Shortcut for '--diff-merges=remerge -p'. | |
61 | ||
1d24509b | 62 | --no-diff-merges:: |
be3820c6 SO |
63 | Synonym for '--diff-merges=off'. |
64 | ||
65 | --diff-merges=<format>:: | |
1d24509b | 66 | Specify diff format to be used for merge commits. Default is |
be3820c6 SO |
67 | {diff-merges-default} unless `--first-parent` is in use, in |
68 | which case `first-parent` is the default. | |
1d24509b | 69 | + |
be3820c6 SO |
70 | The following formats are supported: |
71 | + | |
72 | -- | |
73 | off, none:: | |
1d24509b SO |
74 | Disable output of diffs for merge commits. Useful to override |
75 | implied value. | |
76 | + | |
be3820c6 SO |
77 | on, m:: |
78 | Make diff output for merge commits to be shown in the default | |
8183b63f | 79 | format. The default format can be changed using |
be3820c6 | 80 | `log.diffMerges` configuration variable, whose default value |
6a38e333 | 81 | is `separate`. |
364bc11f | 82 | + |
be3820c6 SO |
83 | first-parent, 1:: |
84 | Show full diff with respect to first parent. This is the same | |
85 | format as `--patch` produces for non-merge commits. | |
86 | + | |
87 | separate:: | |
88 | Show full diff with respect to each of parents. | |
89 | Separate log entry and diff is generated for each parent. | |
90 | + | |
91 | combined, c:: | |
92 | Show differences from each of the parents to the merge | |
93 | result simultaneously instead of showing pairwise diff between | |
94 | a parent and the result one at a time. Furthermore, it lists | |
95 | only files which were modified from all parents. | |
1d24509b | 96 | + |
be3820c6 SO |
97 | dense-combined, cc:: |
98 | Further compress output produced by `--diff-merges=combined` | |
99 | by omitting uninteresting hunks whose contents in the parents | |
100 | have only two variants and the merge result picks one of them | |
101 | without modification. | |
1d24509b | 102 | + |
be3820c6 SO |
103 | remerge, r:: |
104 | Remerge two-parent merge commits to create a temporary tree | |
105 | object--potentially containing files with conflict markers | |
106 | and such. A diff is then shown between that temporary tree | |
107 | and the actual merge commit. | |
db757e8b EN |
108 | + |
109 | The output emitted when this option is used is subject to change, and | |
110 | so is its interaction with other options (unless explicitly | |
111 | documented). | |
be3820c6 | 112 | -- |
1d24509b SO |
113 | |
114 | --combined-all-paths:: | |
115 | This flag causes combined diffs (used for merge commits) to | |
116 | list the name of the file from all parents. It thus only has | |
117 | effect when `--diff-merges=[dense-]combined` is in use, and | |
118 | is likely only useful if filename changes are detected (i.e. | |
119 | when either rename or copy detection have been requested). | |
120 | endif::git-log[] | |
121 | ||
4eb99473 | 122 | -U<n>:: |
4eb99473 RR |
123 | --unified=<n>:: |
124 | Generate diffs with <n> lines of context instead of | |
714d491a | 125 | the usual three. |
02bc5b03 | 126 | ifndef::git-format-patch[] |
714d491a | 127 | Implies `--patch`. |
02bc5b03 | 128 | endif::git-format-patch[] |
4eb99473 | 129 | |
af2f3680 NTND |
130 | --output=<file>:: |
131 | Output to a specific file instead of stdout. | |
132 | ||
133 | --output-indicator-new=<char>:: | |
134 | --output-indicator-old=<char>:: | |
135 | --output-indicator-context=<char>:: | |
136 | Specify the character used to indicate new, old or context | |
137 | lines in the generated patch. Normally they are '+', '-' and | |
138 | ' ' respectively. | |
139 | ||
d4cb003f | 140 | ifndef::git-format-patch[] |
b5376648 | 141 | --raw:: |
d89df367 MM |
142 | ifndef::git-log[] |
143 | Generate the diff in raw format. | |
d0258b93 JK |
144 | ifdef::git-diff-core[] |
145 | This is the default. | |
146 | endif::git-diff-core[] | |
d89df367 MM |
147 | endif::git-log[] |
148 | ifdef::git-log[] | |
149 | For each commit, show a summary of changes using the raw diff | |
150 | format. See the "RAW OUTPUT FORMAT" section of | |
151 | linkgit:git-diff[1]. This is different from showing the log | |
152 | itself in raw format, which you can achieve with | |
153 | `--format=raw`. | |
154 | endif::git-log[] | |
d4cb003f | 155 | endif::git-format-patch[] |
b5376648 | 156 | |
02bc5b03 | 157 | ifndef::git-format-patch[] |
5c91da25 | 158 | --patch-with-raw:: |
dce5ef14 | 159 | Synonym for `-p --raw`. |
02bc5b03 | 160 | endif::git-format-patch[] |
5c91da25 | 161 | |
9a6d515f JK |
162 | ifdef::git-log[] |
163 | -t:: | |
164 | Show the tree objects in the diff output. | |
165 | endif::git-log[] | |
166 | ||
bab76141 | 167 | --indent-heuristic:: |
7eedad15 | 168 | Enable the heuristic that shifts diff hunk boundaries to make patches |
bab76141 CMN |
169 | easier to read. This is the default. |
170 | ||
171 | --no-indent-heuristic:: | |
172 | Disable the indent heuristic. | |
5580b271 | 173 | |
81b568c8 JH |
174 | --minimal:: |
175 | Spend extra time to make sure the smallest possible | |
176 | diff is produced. | |
177 | ||
ec74042d | 178 | --patience:: |
34292bdd JS |
179 | Generate a diff using the "patience diff" algorithm. |
180 | ||
d909e076 TR |
181 | --histogram:: |
182 | Generate a diff using the "histogram diff" algorithm. | |
183 | ||
2477ab2e JT |
184 | --anchored=<text>:: |
185 | Generate a diff using the "anchored diff" algorithm. | |
186 | + | |
187 | This option may be specified more than once. | |
188 | + | |
189 | If a line exists in both the source and destination, exists only once, | |
190 | and starts with this text, this algorithm attempts to prevent it from | |
191 | appearing as a deletion or addition in the output. It uses the "patience | |
192 | diff" algorithm internally. | |
193 | ||
07924d4d MP |
194 | --diff-algorithm={patience|minimal|histogram|myers}:: |
195 | Choose a diff algorithm. The variants are as follows: | |
196 | + | |
197 | -- | |
198 | `default`, `myers`;; | |
199 | The basic greedy diff algorithm. Currently, this is the default. | |
200 | `minimal`;; | |
201 | Spend extra time to make sure the smallest possible diff is | |
202 | produced. | |
203 | `patience`;; | |
204 | Use "patience diff" algorithm when generating patches. | |
205 | `histogram`;; | |
206 | This algorithm extends the patience algorithm to "support | |
207 | low-occurrence common elements". | |
208 | -- | |
209 | + | |
7eedad15 | 210 | For instance, if you configured the `diff.algorithm` variable to a |
07924d4d MP |
211 | non-default value and want to use the default one, then you |
212 | have to use `--diff-algorithm=default` option. | |
213 | ||
808e1db2 | 214 | --stat[=<width>[,<name-width>[,<count>]]]:: |
1b058bc3 | 215 | Generate a diffstat. By default, as much space as necessary |
df44483a ZJS |
216 | will be used for the filename part, and the rest for the graph |
217 | part. Maximum width defaults to terminal width, or 80 columns | |
8d8136c3 | 218 | if not connected to a terminal, and can be overridden by |
df44483a | 219 | `<width>`. The width of the filename part can be limited by |
bd48adc3 DS |
220 | giving another width `<name-width>` after a comma or by setting |
221 | `diff.statNameWidth=<width>`. The width of the graph part can be | |
222 | limited by using `--stat-graph-width=<width>` or by setting | |
223 | `diff.statGraphWidth=<width>`. Using `--stat` or | |
224 | `--stat-graph-width` affects all commands generating a stat graph, | |
225 | while setting `diff.statNameWidth` or `diff.statGraphWidth` | |
226 | does not affect `git format-patch`. | |
227 | By giving a third parameter `<count>`, you can limit the output to | |
228 | the first `<count>` lines, followed by `...` if there are more. | |
86e1ce96 MG |
229 | + |
230 | These parameters can also be set individually with `--stat-width=<width>`, | |
231 | `--stat-name-width=<name-width>` and `--stat-count=<count>`. | |
d75f7952 | 232 | |
ddf88fa6 NTND |
233 | --compact-summary:: |
234 | Output a condensed summary of extended header information such | |
235 | as file creations or deletions ("new" or "gone", optionally "+l" | |
236 | if it's a symlink) and mode changes ("+x" or "-x" for adding | |
237 | or removing executable bit respectively) in diffstat. The | |
1f2abe68 | 238 | information is put between the filename part and the graph |
ddf88fa6 NTND |
239 | part. Implies `--stat`. |
240 | ||
74e2abe5 | 241 | --numstat:: |
6cf378f0 | 242 | Similar to `--stat`, but shows number of added and |
74e2abe5 | 243 | deleted lines in decimal notation and pathname without |
2f89543e JH |
244 | abbreviation, to make it more machine friendly. For |
245 | binary files, outputs two `-` instead of saying | |
246 | `0 0`. | |
74e2abe5 | 247 | |
ebd124c6 | 248 | --shortstat:: |
dce5ef14 | 249 | Output only the last line of the `--stat` format containing total |
ebd124c6 NP |
250 | number of modified files, as well as number of added and deleted |
251 | lines. | |
252 | ||
4ce7aab5 | 253 | -X[<param1,param2,...>]:: |
333f3fb0 JH |
254 | --dirstat[=<param1,param2,...>]:: |
255 | Output the distribution of relative amount of changes for each | |
256 | sub-directory. The behavior of `--dirstat` can be customized by | |
257 | passing it a comma separated list of parameters. | |
2d174951 JH |
258 | The defaults are controlled by the `diff.dirstat` configuration |
259 | variable (see linkgit:git-config[1]). | |
333f3fb0 | 260 | The following parameters are available: |
204f01a2 | 261 | + |
333f3fb0 JH |
262 | -- |
263 | `changes`;; | |
264 | Compute the dirstat numbers by counting the lines that have been | |
265 | removed from the source, or added to the destination. This ignores | |
266 | the amount of pure code movements within a file. In other words, | |
267 | rearranging lines in a file is not counted as much as other changes. | |
268 | This is the default behavior when no parameter is given. | |
1c57a627 JH |
269 | `lines`;; |
270 | Compute the dirstat numbers by doing the regular line-based diff | |
271 | analysis, and summing the removed/added line counts. (For binary | |
272 | files, count 64-byte chunks instead, since binary files have no | |
273 | natural concept of lines). This is a more expensive `--dirstat` | |
274 | behavior than the `changes` behavior, but it does count rearranged | |
275 | lines within a file as much as other changes. The resulting output | |
276 | is consistent with what you get from the other `--*stat` options. | |
333f3fb0 JH |
277 | `files`;; |
278 | Compute the dirstat numbers by counting the number of files changed. | |
279 | Each changed file counts equally in the dirstat analysis. This is | |
280 | the computationally cheapest `--dirstat` behavior, since it does | |
281 | not have to look at the file contents at all. | |
282 | `cumulative`;; | |
283 | Count changes in a child directory for the parent directory as well. | |
284 | Note that when using `cumulative`, the sum of the percentages | |
285 | reported may exceed 100%. The default (non-cumulative) behavior can | |
286 | be specified with the `noncumulative` parameter. | |
287 | <limit>;; | |
288 | An integer parameter specifies a cut-off percent (3% by default). | |
289 | Directories contributing less than this percentage of the changes | |
290 | are not shown in the output. | |
291 | -- | |
292 | + | |
293 | Example: The following will count changed files, while ignoring | |
294 | directories with less than 10% of the total amount of changed files, | |
295 | and accumulating child directory counts in the parent directories: | |
296 | `--dirstat=files,10,cumulative`. | |
fd33777b | 297 | |
4ce7aab5 NTND |
298 | --cumulative:: |
299 | Synonym for --dirstat=cumulative | |
300 | ||
301 | --dirstat-by-file[=<param1,param2>...]:: | |
302 | Synonym for --dirstat=files,param1,param2... | |
303 | ||
4bbd261b SE |
304 | --summary:: |
305 | Output a condensed summary of extended header information | |
306 | such as creations, renames and mode changes. | |
307 | ||
02bc5b03 | 308 | ifndef::git-format-patch[] |
29353273 | 309 | --patch-with-stat:: |
dce5ef14 | 310 | Synonym for `-p --stat`. |
02bc5b03 | 311 | endif::git-format-patch[] |
29353273 | 312 | |
d4cb003f | 313 | ifndef::git-format-patch[] |
64485b4a | 314 | |
dda2d79a | 315 | -z:: |
5c931c8d | 316 | ifdef::git-log[] |
97509a34 | 317 | Separate the commits with NULs instead of newlines. |
5c931c8d BG |
318 | + |
319 | Also, when `--raw` or `--numstat` has been given, do not munge | |
320 | pathnames and use NULs as output field terminators. | |
321 | endif::git-log[] | |
64485b4a | 322 | ifndef::git-log[] |
03aa87ed CB |
323 | When `--raw`, `--numstat`, `--name-only` or `--name-status` has been |
324 | given, do not munge pathnames and use NULs as output field terminators. | |
5c931c8d | 325 | endif::git-log[] |
64485b4a | 326 | + |
860cd699 AH |
327 | Without this option, pathnames with "unusual" characters are quoted as |
328 | explained for the configuration variable `core.quotePath` (see | |
329 | linkgit:git-config[1]). | |
dda2d79a JH |
330 | |
331 | --name-only:: | |
9364bf46 AB |
332 | Show only names of changed files. The file names are often encoded in UTF-8. |
333 | For more information see the discussion about encoding in the linkgit:git-log[1] | |
334 | manual page. | |
dda2d79a | 335 | |
946f5f7c | 336 | --name-status:: |
a6f47b2b MV |
337 | Show only names and status of changed files. See the description |
338 | of the `--diff-filter` option on what the status letters mean. | |
9364bf46 | 339 | Just like `--name-only` the file names are often encoded in UTF-8. |
dda2d79a | 340 | |
752c0c24 | 341 | --submodule[=<format>]:: |
fd47ae6a JK |
342 | Specify how differences in submodules are shown. When specifying |
343 | `--submodule=short` the 'short' format is used. This format just | |
344 | shows the names of the commits at the beginning and end of the range. | |
345 | When `--submodule` or `--submodule=log` is specified, the 'log' | |
346 | format is used. This format lists the commits in the range like | |
347 | linkgit:git-submodule[1] `summary` does. When `--submodule=diff` | |
348 | is specified, the 'diff' format is used. This format shows an | |
349 | inline diff of the changes in the submodule contents between the | |
350 | commit range. Defaults to `diff.submodule` or the 'short' format | |
351 | if the config option is unset. | |
752c0c24 | 352 | |
73e9da01 | 353 | --color[=<when>]:: |
b5376648 | 354 | Show colored diff. |
3d0e75f2 JH |
355 | `--color` (i.e. without '=<when>') is the same as `--color=always`. |
356 | '<when>' can be one of `always`, `never`, or `auto`. | |
6999c540 MG |
357 | ifdef::git-diff[] |
358 | It can be changed by the `color.ui` and `color.diff` | |
359 | configuration settings. | |
360 | endif::git-diff[] | |
b5376648 JH |
361 | |
362 | --no-color:: | |
6999c540 MG |
363 | Turn off colored diff. |
364 | ifdef::git-diff[] | |
365 | This can be used to override configuration settings. | |
366 | endif::git-diff[] | |
367 | It is the same as `--color=never`. | |
b5376648 | 368 | |
61e89eaa SB |
369 | --color-moved[=<mode>]:: |
370 | Moved lines of code are colored differently. | |
371 | ifdef::git-diff[] | |
372 | It can be changed by the `diff.colorMoved` configuration setting. | |
373 | endif::git-diff[] | |
374 | The <mode> defaults to 'no' if the option is not given | |
375 | and to 'zebra' if the option with no mode is given. | |
376 | The mode must be one of: | |
377 | + | |
378 | -- | |
379 | no:: | |
380 | Moved lines are not highlighted. | |
381 | default:: | |
382 | Is a synonym for `zebra`. This may change to a more sensible mode | |
383 | in the future. | |
384 | plain:: | |
385 | Any line that is added in one location and was removed | |
386 | in another location will be colored with 'color.diff.newMoved'. | |
387 | Similarly 'color.diff.oldMoved' will be used for removed lines | |
388 | that are added somewhere else in the diff. This mode picks up any | |
389 | moved line, but it is not very useful in a review to determine | |
390 | if a block of code was moved without permutation. | |
51da15eb | 391 | blocks:: |
f0b8fb6e JT |
392 | Blocks of moved text of at least 20 alphanumeric characters |
393 | are detected greedily. The detected blocks are | |
51da15eb SB |
394 | painted using either the 'color.diff.{old,new}Moved' color. |
395 | Adjacent blocks cannot be told apart. | |
396 | zebra:: | |
397 | Blocks of moved text are detected as in 'blocks' mode. The blocks | |
398 | are painted using either the 'color.diff.{old,new}Moved' color or | |
61e89eaa | 399 | 'color.diff.{old,new}MovedAlternative'. The change between |
f0b8fb6e | 400 | the two colors indicates that a new block was detected. |
e3f2f5f9 | 401 | dimmed-zebra:: |
61e89eaa SB |
402 | Similar to 'zebra', but additional dimming of uninteresting parts |
403 | of moved code is performed. The bordering lines of two adjacent | |
404 | blocks are considered interesting, the rest is uninteresting. | |
e3f2f5f9 | 405 | `dimmed_zebra` is a deprecated synonym. |
61e89eaa SB |
406 | -- |
407 | ||
fbafb7c6 PW |
408 | --no-color-moved:: |
409 | Turn off move detection. This can be used to override configuration | |
410 | settings. It is the same as `--color-moved=no`. | |
411 | ||
b3095712 | 412 | --color-moved-ws=<modes>:: |
748aa1aa | 413 | This configures how whitespace is ignored when performing the |
626c0b5d SB |
414 | move detection for `--color-moved`. |
415 | ifdef::git-diff[] | |
416 | It can be set by the `diff.colorMovedWS` configuration setting. | |
417 | endif::git-diff[] | |
418 | These modes can be given as a comma separated list: | |
b3095712 SB |
419 | + |
420 | -- | |
b73bcbac PW |
421 | no:: |
422 | Do not ignore whitespace when performing move detection. | |
b3095712 SB |
423 | ignore-space-at-eol:: |
424 | Ignore changes in whitespace at EOL. | |
425 | ignore-space-change:: | |
426 | Ignore changes in amount of whitespace. This ignores whitespace | |
427 | at line end, and considers all other sequences of one or | |
428 | more whitespace characters to be equivalent. | |
429 | ignore-all-space:: | |
430 | Ignore whitespace when comparing lines. This ignores differences | |
431 | even if one line has whitespace where the other line has none. | |
ca1f4ae4 | 432 | allow-indentation-change:: |
748aa1aa | 433 | Initially ignore any whitespace in the move detection, then |
ca1f4ae4 SB |
434 | group the moved code blocks only into a block if the change in |
435 | whitespace is the same per line. This is incompatible with the | |
436 | other modes. | |
b3095712 SB |
437 | -- |
438 | ||
b73bcbac PW |
439 | --no-color-moved-ws:: |
440 | Do not ignore whitespace when performing move detection. This can be | |
441 | used to override configuration settings. It is the same as | |
442 | `--color-moved-ws=no`. | |
443 | ||
882749a0 TR |
444 | --word-diff[=<mode>]:: |
445 | Show a word diff, using the <mode> to delimit changed words. | |
446 | By default, words are delimited by whitespace; see | |
447 | `--word-diff-regex` below. The <mode> defaults to 'plain', and | |
448 | must be one of: | |
449 | + | |
450 | -- | |
451 | color:: | |
452 | Highlight changed words using only colors. Implies `--color`. | |
453 | plain:: | |
454 | Show words as `[-removed-]` and `{+added+}`. Makes no | |
455 | attempts to escape the delimiters if they appear in the input, | |
456 | so the output may be ambiguous. | |
457 | porcelain:: | |
458 | Use a special line-based format intended for script | |
459 | consumption. Added/removed/unchanged runs are printed in the | |
460 | usual unified diff format, starting with a `+`/`-`/` ` | |
461 | character at the beginning of the line and extending to the | |
462 | end of the line. Newlines in the input are represented by a | |
463 | tilde `~` on a line of its own. | |
464 | none:: | |
465 | Disable word diff again. | |
466 | -- | |
467 | + | |
468 | Note that despite the name of the first mode, color is used to | |
469 | highlight the changed parts in all modes if enabled. | |
470 | ||
471 | --word-diff-regex=<regex>:: | |
472 | Use <regex> to decide what a word is, instead of considering | |
473 | runs of non-whitespace to be a word. Also implies | |
474 | `--word-diff` unless it was already enabled. | |
2b6a5417 | 475 | + |
882749a0 | 476 | Every non-overlapping match of the |
c4b252c3 TR |
477 | <regex> is considered a word. Anything between these matches is |
478 | considered whitespace and ignored(!) for the purposes of finding | |
479 | differences. You may want to append `|[^[:space:]]` to your regular | |
480 | expression to make sure that it matches all non-whitespace characters. | |
481 | A match that contains a newline is silently truncated(!) at the | |
482 | newline. | |
80c49c3d | 483 | + |
2c15c006 MG |
484 | For example, `--word-diff-regex=.` will treat each character as a word |
485 | and, correspondingly, show differences character by character. | |
486 | + | |
98a4d87b | 487 | The regex can also be set via a diff driver or configuration option, see |
1cca17df | 488 | linkgit:gitattributes[5] or linkgit:git-config[1]. Giving it explicitly |
98a4d87b BSSJ |
489 | overrides any diff driver or configuration setting. Diff drivers |
490 | override configuration settings. | |
882749a0 TR |
491 | |
492 | --color-words[=<regex>]:: | |
493 | Equivalent to `--word-diff=color` plus (if a regex was | |
494 | specified) `--word-diff-regex=<regex>`. | |
d4cb003f | 495 | endif::git-format-patch[] |
f59a59e2 | 496 | |
b5376648 JH |
497 | --no-renames:: |
498 | Turn off rename detection, even when the configuration | |
499 | file gives the default to do so. | |
500 | ||
cdc43eb0 NTND |
501 | --[no-]rename-empty:: |
502 | Whether to use empty blobs as rename source. | |
503 | ||
02bc5b03 | 504 | ifndef::git-format-patch[] |
16507fcf | 505 | --check:: |
30211fb6 OA |
506 | Warn if changes introduce conflict markers or whitespace errors. |
507 | What are considered whitespace errors is controlled by `core.whitespace` | |
4f830390 | 508 | configuration. By default, trailing whitespaces (including |
7eedad15 | 509 | lines that consist solely of whitespaces) and a space character |
4f830390 CK |
510 | that is immediately followed by a tab character inside the |
511 | initial indent of the line are considered whitespace errors. | |
512 | Exits with non-zero status if problems are found. Not compatible | |
513 | with --exit-code. | |
b8767f79 JH |
514 | |
515 | --ws-error-highlight=<kind>:: | |
c0bb6d9c AH |
516 | Highlight whitespace errors in the `context`, `old` or `new` |
517 | lines of the diff. Multiple values are separated by comma, | |
518 | `none` resets previous values, `default` reset the list to | |
519 | `new` and `all` is a shorthand for `old,new,context`. When | |
520 | this option is not given, and the configuration variable | |
521 | `diff.wsErrorHighlight` is not set, only whitespace errors in | |
522 | `new` lines are highlighted. The whitespace errors are colored | |
7eedad15 | 523 | with `color.diff.whitespace`. |
b8767f79 | 524 | |
02bc5b03 | 525 | endif::git-format-patch[] |
16507fcf | 526 | |
80b1e511 | 527 | --full-index:: |
6457e58c JM |
528 | Instead of the first handful of characters, show the full |
529 | pre- and post-image blob object names on the "index" | |
530 | line when generating patch format output. | |
b5376648 JH |
531 | |
532 | --binary:: | |
dce5ef14 | 533 | In addition to `--full-index`, output a binary diff that |
714d491a SO |
534 | can be applied with `git-apply`. |
535 | ifndef::git-format-patch[] | |
536 | Implies `--patch`. | |
537 | endif::git-format-patch[] | |
80b1e511 | 538 | |
913419fc | 539 | --abbrev[=<n>]:: |
47dd0d59 JH |
540 | Instead of showing the full 40-byte hexadecimal object |
541 | name in diff-raw format output and diff-tree header | |
cda34e0d JH |
542 | lines, show the shortest prefix that is at least '<n>' |
543 | hexdigits long that uniquely refers the object. | |
3046c7f6 ĐTCD |
544 | In diff-patch output format, `--full-index` takes higher |
545 | precedence, i.e. if `--full-index` is specified, full blob | |
546 | names will be shown regardless of `--abbrev`. | |
547 | Non default number of digits can be specified with `--abbrev=<n>`. | |
47dd0d59 | 548 | |
cf958afd | 549 | -B[<n>][/<m>]:: |
37ab5156 | 550 | --break-rewrites[=[<n>][/<m>]]:: |
cf958afd MM |
551 | Break complete rewrite changes into pairs of delete and |
552 | create. This serves two purposes: | |
553 | + | |
554 | It affects the way a change that amounts to a total rewrite of a file | |
555 | not as a series of deletion and insertion mixed together with a very | |
556 | few lines that happen to match textually as the context, but as a | |
557 | single deletion of everything old followed by a single insertion of | |
558 | everything new, and the number `m` controls this aspect of the -B | |
559 | option (defaults to 60%). `-B/70%` specifies that less than 30% of the | |
2de9b711 | 560 | original should remain in the result for Git to consider it a total |
cf958afd MM |
561 | rewrite (i.e. otherwise the resulting patch will be a series of |
562 | deletion and insertion mixed together with context lines). | |
563 | + | |
564 | When used with -M, a totally-rewritten file is also considered as the | |
565 | source of a rename (usually -M only considers a file that disappeared | |
566 | as the source of a rename), and the number `n` controls this aspect of | |
567 | the -B option (defaults to 50%). `-B20%` specifies that a change with | |
568 | addition and deletion compared to 20% or more of the file's size are | |
569 | eligible for being picked up as a possible source of a rename to | |
570 | another file. | |
571 | ||
572 | -M[<n>]:: | |
f611ddc7 | 573 | --find-renames[=<n>]:: |
7ffad250 | 574 | ifndef::git-log[] |
dda2d79a | 575 | Detect renames. |
7ffad250 JK |
576 | endif::git-log[] |
577 | ifdef::git-log[] | |
578 | If generating diffs, detect and report renames for each commit. | |
579 | For following files across renames while traversing history, see | |
580 | `--follow`. | |
581 | endif::git-log[] | |
4c007ae8 | 582 | If `n` is specified, it is a threshold on the similarity |
cf958afd | 583 | index (i.e. amount of addition/deletions compared to the |
2de9b711 | 584 | file's size). For example, `-M90%` means Git should consider a |
cf958afd | 585 | delete/add pair to be a rename if more than 90% of the file |
31d66aa4 SC |
586 | hasn't changed. Without a `%` sign, the number is to be read as |
587 | a fraction, with a decimal point before it. I.e., `-M5` becomes | |
588 | 0.5, and is thus the same as `-M50%`. Similarly, `-M05` is | |
589 | the same as `-M5%`. To limit detection to exact renames, use | |
8240943b | 590 | `-M100%`. The default similarity index is 50%. |
dda2d79a | 591 | |
cf958afd | 592 | -C[<n>]:: |
f611ddc7 | 593 | --find-copies[=<n>]:: |
ca6c0970 | 594 | Detect copies as well as renames. See also `--find-copies-harder`. |
cf958afd | 595 | If `n` is specified, it has the same meaning as for `-M<n>`. |
dda2d79a JH |
596 | |
597 | --find-copies-harder:: | |
ca6c0970 | 598 | For performance reasons, by default, `-C` option finds copies only |
a6080a0a | 599 | if the original file of the copy was modified in the same |
f73ae1fc | 600 | changeset. This flag makes the command |
dda2d79a JH |
601 | inspect unmodified files as candidates for the source of |
602 | copy. This is a very expensive operation for large | |
ca6c0970 JS |
603 | projects, so use it with caution. Giving more than one |
604 | `-C` option has the same effect. | |
dda2d79a | 605 | |
467ddc14 JH |
606 | -D:: |
607 | --irreversible-delete:: | |
608 | Omit the preimage for deletes, i.e. print only the header but not | |
609 | the diff between the preimage and `/dev/null`. The resulting patch | |
a58088ab | 610 | is not meant to be applied with `patch` or `git apply`; this is |
467ddc14 | 611 | solely for people who want to just concentrate on reviewing the |
bc9b7e20 | 612 | text after the change. In addition, the output obviously lacks |
467ddc14 JH |
613 | enough information to apply such a patch in reverse, even manually, |
614 | hence the name of the option. | |
615 | + | |
616 | When used together with `-B`, omit also the preimage in the deletion part | |
617 | of a delete/create pair. | |
618 | ||
8082d8d3 | 619 | -l<num>:: |
6623a528 EN |
620 | The `-M` and `-C` options involve some preliminary steps that |
621 | can detect subsets of renames/copies cheaply, followed by an | |
622 | exhaustive fallback portion that compares all remaining | |
623 | unpaired destinations to all relevant sources. (For renames, | |
624 | only remaining unpaired sources are relevant; for copies, all | |
625 | original sources are relevant.) For N sources and | |
626 | destinations, this exhaustive check is O(N^2). This option | |
627 | prevents the exhaustive portion of rename/copy detection from | |
628 | running if the number of source/destination files involved | |
629 | exceeds the specified number. Defaults to diff.renameLimit. | |
9dd29dbe | 630 | Note that a value of 0 is treated as unlimited. |
8082d8d3 | 631 | |
d4cb003f | 632 | ifndef::git-format-patch[] |
f1037448 YD |
633 | --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]:: |
634 | Select only files that are Added (`A`), Copied (`C`), | |
635 | Deleted (`D`), Modified (`M`), Renamed (`R`), have their | |
636 | type (i.e. regular file, symlink, submodule, ...) changed (`T`), | |
637 | are Unmerged (`U`), are | |
638 | Unknown (`X`), or have had their pairing Broken (`B`). | |
639 | Any combination of the filter characters (including none) can be used. | |
640 | When `*` (All-or-none) is added to the combination, all | |
641 | paths are selected if there is any file that matches | |
642 | other criteria in the comparison; if there is no file | |
643 | that matches other criteria, nothing is selected. | |
16726cfa JH |
644 | + |
645 | Also, these upper-case letters can be downcased to exclude. E.g. | |
646 | `--diff-filter=ad` excludes added and deleted paths. | |
46af107b | 647 | + |
d843e319 JS |
648 | Note that not all diffs can feature all types. For instance, copied and |
649 | renamed entries cannot appear if detection for those types is disabled. | |
f1037448 | 650 | |
dda2d79a | 651 | -S<string>:: |
5bc3f0b5 RR |
652 | Look for differences that change the number of occurrences of |
653 | the specified string (i.e. addition/deletion) in a file. | |
654 | Intended for the scripter's use. | |
655 | + | |
656 | It is useful when you're looking for an exact block of code (like a | |
657 | struct), and want to know the history of that block since it first | |
658 | came into being: use the feature iteratively to feed the interesting | |
659 | block in the preimage back into `-S`, and keep going until you get the | |
660 | very first version of the block. | |
e0e7cb80 TB |
661 | + |
662 | Binary files are searched as well. | |
dda2d79a | 663 | |
f506b8e8 | 664 | -G<regex>:: |
5bc3f0b5 RR |
665 | Look for differences whose patch text contains added/removed |
666 | lines that match <regex>. | |
667 | + | |
668 | To illustrate the difference between `-S<regex> --pickaxe-regex` and | |
669 | `-G<regex>`, consider a commit with the following diff in the same | |
670 | file: | |
671 | + | |
672 | ---- | |
9299f849 | 673 | + return frotz(nitfol, two->ptr, 1, 0); |
5bc3f0b5 | 674 | ... |
9299f849 | 675 | - hit = frotz(nitfol, mf2.ptr, 1, 0); |
5bc3f0b5 RR |
676 | ---- |
677 | + | |
9299f849 MÅ |
678 | While `git log -G"frotz\(nitfol"` will show this commit, `git log |
679 | -S"frotz\(nitfol" --pickaxe-regex` will not (because the number of | |
5bc3f0b5 RR |
680 | occurrences of that string did not change). |
681 | + | |
e0e7cb80 TB |
682 | Unless `--text` is supplied patches of binary files without a textconv |
683 | filter will be ignored. | |
684 | + | |
5bc3f0b5 RR |
685 | See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more |
686 | information. | |
f506b8e8 | 687 | |
15af58c1 SB |
688 | --find-object=<object-id>:: |
689 | Look for differences that change the number of occurrences of | |
690 | the specified object. Similar to `-S`, just the argument is different | |
691 | in that it doesn't search for a specific string but for a specific | |
692 | object id. | |
693 | + | |
694 | The object can be a blob or a submodule commit. It implies the `-t` option in | |
695 | `git-log` to also find trees. | |
696 | ||
dda2d79a | 697 | --pickaxe-all:: |
f506b8e8 | 698 | When `-S` or `-G` finds a change, show all the changes in that |
f73ae1fc | 699 | changeset, not just the files that contain the change |
dda2d79a JH |
700 | in <string>. |
701 | ||
d01d8c67 | 702 | --pickaxe-regex:: |
5bc3f0b5 RR |
703 | Treat the <string> given to `-S` as an extended POSIX regular |
704 | expression to match. | |
15af58c1 | 705 | |
d4cb003f | 706 | endif::git-format-patch[] |
d01d8c67 | 707 | |
dda2d79a | 708 | -O<orderfile>:: |
874444b7 | 709 | Control the order in which files appear in the output. |
da0005b8 NTND |
710 | This overrides the `diff.orderFile` configuration variable |
711 | (see linkgit:git-config[1]). To cancel `diff.orderFile`, | |
6d8940b5 | 712 | use `-O/dev/null`. |
874444b7 RH |
713 | + |
714 | The output order is determined by the order of glob patterns in | |
715 | <orderfile>. | |
716 | All files with pathnames that match the first pattern are output | |
717 | first, all files with pathnames that match the second pattern (but not | |
718 | the first) are output next, and so on. | |
719 | All files with pathnames that do not match any pattern are output | |
720 | last, as if there was an implicit match-all pattern at the end of the | |
721 | file. | |
722 | If multiple pathnames have the same rank (they match the same pattern | |
723 | but no earlier patterns), their output order relative to each other is | |
724 | the normal order. | |
725 | + | |
726 | <orderfile> is parsed as follows: | |
727 | + | |
728 | -- | |
729 | - Blank lines are ignored, so they can be used as separators for | |
730 | readability. | |
731 | ||
732 | - Lines starting with a hash ("`#`") are ignored, so they can be used | |
733 | for comments. Add a backslash ("`\`") to the beginning of the | |
734 | pattern if it starts with a hash. | |
735 | ||
736 | - Each other line contains a single pattern. | |
737 | -- | |
738 | + | |
739 | Patterns have the same syntax and semantics as patterns used for | |
c30d4f1b | 740 | fnmatch(3) without the FNM_PATHNAME flag, except a pathname also |
874444b7 RH |
741 | matches a pattern if removing any number of the final pathname |
742 | components matches the pattern. For example, the pattern "`foo*bar`" | |
743 | matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`". | |
dda2d79a | 744 | |
1eb4136a JH |
745 | --skip-to=<file>:: |
746 | --rotate-to=<file>:: | |
747 | Discard the files before the named <file> from the output | |
748 | (i.e. 'skip to'), or move them to the end of the output | |
cf6cac20 | 749 | (i.e. 'rotate to'). These options were invented primarily for the use |
1eb4136a JH |
750 | of the `git difftool` command, and may not be very useful |
751 | otherwise. | |
752 | ||
d4cb003f | 753 | ifndef::git-format-patch[] |
dda2d79a | 754 | -R:: |
5f3aa197 | 755 | Swap two inputs; that is, show differences from index or |
dda2d79a | 756 | on-disk file to tree contents. |
c28ded83 | 757 | endif::git-format-patch[] |
dda2d79a | 758 | |
c0cb4a06 | 759 | --relative[=<path>]:: |
c28ded83 | 760 | --no-relative:: |
cd676a51 JH |
761 | When run from a subdirectory of the project, it can be |
762 | told to exclude changes outside the directory and show | |
c0cb4a06 JH |
763 | pathnames relative to it with this option. When you are |
764 | not in a subdirectory (e.g. in a bare repository), you | |
765 | can name which subdirectory to make the output relative | |
766 | to by giving a <path> as an argument. | |
c28ded83 LA |
767 | `--no-relative` can be used to countermand both `diff.relative` config |
768 | option and previous `--relative`. | |
cd676a51 | 769 | |
a9e67c8c | 770 | -a:: |
d507bb15 SF |
771 | --text:: |
772 | Treat all files as text. | |
773 | ||
e9282f02 | 774 | --ignore-cr-at-eol:: |
c30d4f1b | 775 | Ignore carriage-return at the end of line when doing a comparison. |
e9282f02 | 776 | |
a44a0c99 | 777 | --ignore-space-at-eol:: |
0ac7903e | 778 | Ignore changes in whitespace at EOL. |
a44a0c99 | 779 | |
a9e67c8c | 780 | -b:: |
8ebe185b | 781 | --ignore-space-change:: |
0ac7903e WC |
782 | Ignore changes in amount of whitespace. This ignores whitespace |
783 | at line end, and considers all other sequences of one or | |
784 | more whitespace characters to be equivalent. | |
8ebe185b | 785 | |
a9e67c8c | 786 | -w:: |
8ebe185b | 787 | --ignore-all-space:: |
0ac7903e WC |
788 | Ignore whitespace when comparing lines. This ignores |
789 | differences even if one line has whitespace where the other | |
8ebe185b JN |
790 | line has none. |
791 | ||
36617af7 AP |
792 | --ignore-blank-lines:: |
793 | Ignore changes whose lines are all blank. | |
794 | ||
296d4a94 MK |
795 | -I<regex>:: |
796 | --ignore-matching-lines=<regex>:: | |
797 | Ignore changes whose all lines match <regex>. This option may | |
798 | be specified more than once. | |
799 | ||
6d0e674a RS |
800 | --inter-hunk-context=<lines>:: |
801 | Show the context between diff hunks, up to the specified number | |
802 | of lines, thereby fusing hunks that are close to each other. | |
c4888677 VN |
803 | Defaults to `diff.interHunkContext` or 0 if the config option |
804 | is unset. | |
6d0e674a | 805 | |
14937c2c RS |
806 | -W:: |
807 | --function-context:: | |
0cce88f1 PB |
808 | Show whole function as context lines for each change. |
809 | The function names are determined in the same way as | |
810 | `git diff` works out patch hunk headers (see 'Defining a | |
811 | custom hunk-header' in linkgit:gitattributes[5]). | |
14937c2c | 812 | |
d4cb003f | 813 | ifndef::git-format-patch[] |
939ca96b | 814 | ifndef::git-log[] |
41bbf9d5 AR |
815 | --exit-code:: |
816 | Make the program exit with codes similar to diff(1). | |
817 | That is, it exits with 1 if there were differences and | |
818 | 0 means no differences. | |
819 | ||
2a18c266 | 820 | --quiet:: |
dce5ef14 | 821 | Disable all output of the program. Implies `--exit-code`. |
939ca96b | 822 | endif::git-log[] |
d4cb003f | 823 | endif::git-format-patch[] |
2a18c266 | 824 | |
72909bef JS |
825 | --ext-diff:: |
826 | Allow an external diff helper to be executed. If you set an | |
5162e697 DM |
827 | external diff driver with linkgit:gitattributes[5], you need |
828 | to use this option with linkgit:git-log[1] and friends. | |
72909bef JS |
829 | |
830 | --no-ext-diff:: | |
831 | Disallow external diff drivers. | |
832 | ||
d28790dc JK |
833 | --textconv:: |
834 | --no-textconv:: | |
835 | Allow (or disallow) external text conversion filters to be run | |
836 | when comparing binary files. See linkgit:gitattributes[5] for | |
837 | details. Because textconv filters are typically a one-way | |
838 | conversion, the resulting diff is suitable for human | |
839 | consumption, but cannot be applied. For this reason, textconv | |
840 | filters are enabled by default only for linkgit:git-diff[1] and | |
841 | linkgit:git-log[1], but not for linkgit:git-format-patch[1] or | |
842 | diff plumbing commands. | |
843 | ||
dd44d419 JL |
844 | --ignore-submodules[=<when>]:: |
845 | Ignore changes to submodules in the diff generation. <when> can be | |
b1d04bfc | 846 | either "none", "untracked", "dirty" or "all", which is the default. |
aee9c7d6 JL |
847 | Using "none" will consider the submodule modified when it either contains |
848 | untracked or modified files or its HEAD differs from the commit recorded | |
849 | in the superproject and can be used to override any settings of the | |
302ad7a9 | 850 | 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When |
dd44d419 JL |
851 | "untracked" is used submodules are not considered dirty when they only |
852 | contain untracked content (but they are still scanned for modified | |
853 | content). Using "dirty" ignores all changes to the work tree of submodules, | |
854 | only changes to the commits stored in the superproject are shown (this was | |
855 | the behavior until 1.7.0). Using "all" hides all changes to submodules. | |
50fd9bd8 | 856 | |
eab9a40b JS |
857 | --src-prefix=<prefix>:: |
858 | Show the given source prefix instead of "a/". | |
859 | ||
860 | --dst-prefix=<prefix>:: | |
861 | Show the given destination prefix instead of "b/". | |
862 | ||
863 | --no-prefix:: | |
864 | Do not show any source or destination prefix. | |
865 | ||
b39a5697 JK |
866 | --default-prefix:: |
867 | Use the default source and destination prefixes ("a/" and "b/"). | |
868 | This is usually the default already, but may be used to override | |
869 | config such as `diff.noprefix`. | |
870 | ||
660e113c JK |
871 | --line-prefix=<prefix>:: |
872 | Prepend an additional prefix to every line of output. | |
873 | ||
b42b4519 NTND |
874 | --ita-invisible-in-index:: |
875 | By default entries added by "git add -N" appear as an existing | |
876 | empty file in "git diff" and a new file in "git diff --cached". | |
877 | This option makes the entry appear as a new file in "git diff" | |
878 | and non-existent in "git diff --cached". This option could be | |
879 | reverted with `--ita-visible-in-index`. Both options are | |
880 | experimental and could be removed in future. | |
881 | ||
8db9307c | 882 | For more detailed explanation on these common options, see also |
6998e4db | 883 | linkgit:gitdiffcore[7]. |