doc: git-diff: apply format changes to diff-options
The format change is only applied to the sections of the file that are filtered in git-diff. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jean-Noël Avila committed
Nov 18, 2024 at 22:05 UTC
6b552e39c01f6a38158eab78816e8954ec46ccde
1 file changed
+212
-211
Documentation/diff-options.txt
+212
-211
@@ -19,16 +19,16 @@ ifdef::git-format-patch[]
19
endif::git-format-patch[]
20
21
ifndef::git-format-patch[]
22
--p::
23
--u::
24
---patch::
22
+`-p`::
23
+`-u`::
24
+`--patch`::
25
Generate patch (see <<generate_patch_text_with_p>>).
26
ifdef::git-diff[]
27
This is the default.
28
endif::git-diff[]
29
30
--s::
31
---no-patch::
30
+`-s`::
31
+`--no-patch`::
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
@@ -39,28 +39,28 @@ endif::git-format-patch[]
39
ifdef::git-log[]
40
-m::
41
Show diffs for merge commits in the default format. This is
42
- similar to '--diff-merges=on', except `-m` will
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'.
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'.
51
+ Shortcut for `--diff-merges=dense-combined -p`.
52
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'.
56
+ Shortcut for `--diff-merges=first-parent -p`.
57
58
--remerge-diff::
59
Produce remerge-diff output for merge commits.
60
- Shortcut for '--diff-merges=remerge -p'.
60
+ Shortcut for `--diff-merges=remerge -p`.
61
62
--no-diff-merges::
63
- Synonym for '--diff-merges=off'.
63
+ Synonym for `--diff-merges=off`.
64
65
--diff-merges=<format>::
66
Specify diff format to be used for merge commits. Default is
@@ -73,33 +73,33 @@ The following formats are supported:
73
off, none::
74
Disable output of diffs for merge commits. Useful to override
75
implied value.
76
-+
76
+
77
on, m::
78
Make diff output for merge commits to be shown in the default
79
format. The default format can be changed using
80
`log.diffMerges` configuration variable, whose default value
81
is `separate`.
82
-+
82
+
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
-+
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
-+
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.
96
-+
96
+
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.
102
-+
102
+
103
remerge, r::
104
Remerge two-parent merge commits to create a temporary tree
105
object--potentially containing files with conflict markers
@@ -112,33 +112,33 @@ documented).
112
--
113
114
--combined-all-paths::
115
- This flag causes combined diffs (used for merge commits) to
115
+ Cause 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
122
--U<n>::
123
---unified=<n>::
124
- Generate diffs with <n> lines of context instead of
122
+`-U<n>`::
123
+`--unified=<n>`::
124
+ Generate diffs with _<n>_ lines of context instead of
125
the usual three.
126
ifndef::git-format-patch[]
127
Implies `--patch`.
128
endif::git-format-patch[]
129
130
---output=<file>::
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>::
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
137
+ lines in the generated patch. Normally they are `+`, `-` and
138
' ' respectively.
139
140
ifndef::git-format-patch[]
141
---raw::
141
+`--raw`::
142
ifndef::git-log[]
143
Generate the diff in raw format.
144
ifdef::git-diff-core[]
@@ -155,54 +155,55 @@ endif::git-log[]
155
endif::git-format-patch[]
156
157
ifndef::git-format-patch[]
158
---patch-with-raw::
158
+`--patch-with-raw`::
159
Synonym for `-p --raw`.
160
endif::git-format-patch[]
161
162
ifdef::git-log[]
163
--t::
163
+`-t`::
164
Show the tree objects in the diff output.
165
endif::git-log[]
166
167
---indent-heuristic::
167
+`--indent-heuristic`::
168
Enable the heuristic that shifts diff hunk boundaries to make patches
169
easier to read. This is the default.
170
171
---no-indent-heuristic::
171
+`--no-indent-heuristic`::
172
Disable the indent heuristic.
173
174
---minimal::
174
+`--minimal`::
175
Spend extra time to make sure the smallest possible
176
diff is produced.
177
178
---patience::
178
+`--patience`::
179
Generate a diff using the "patience diff" algorithm.
180
181
---histogram::
181
+`--histogram`::
182
Generate a diff using the "histogram diff" algorithm.
183
184
---anchored=<text>::
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
190
+and starts with _<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
194
---diff-algorithm={patience|minimal|histogram|myers}::
194
+`--diff-algorithm=(patience|minimal|histogram|myers)`::
195
Choose a diff algorithm. The variants are as follows:
196
+
197
--
198
-`default`, `myers`;;
198
+ `default`;;
199
+ `myers`;;
200
The basic greedy diff algorithm. Currently, this is the default.
200
-`minimal`;;
201
+ `minimal`;;
202
Spend extra time to make sure the smallest possible diff is
203
produced.
203
-`patience`;;
204
+ `patience`;;
205
Use "patience diff" algorithm when generating patches.
205
-`histogram`;;
206
+ `histogram`;;
207
This algorithm extends the patience algorithm to "support
208
low-occurrence common elements".
209
--
@@ -211,47 +212,47 @@ For instance, if you configured the `diff.algorithm` variable to a
212
non-default value and want to use the default one, then you
213
have to use `--diff-algorithm=default` option.
214
214
---stat[=<width>[,<name-width>[,<count>]]]::
215
+`--stat[=<width>[,<name-width>[,<count>]]]`::
216
Generate a diffstat. By default, as much space as necessary
217
will be used for the filename part, and the rest for the graph
218
part. Maximum width defaults to terminal width, or 80 columns
219
if not connected to a terminal, and can be overridden by
219
- `<width>`. The width of the filename part can be limited by
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
220
+ _<width>_. The width of the filename part can be limited by
221
+ giving another width _<name-width>_ after a comma or by setting
222
+ `diff.statNameWidth=<name-width>`. The width of the graph part can be
223
+ limited by using `--stat-graph-width=<graph-width>` or by setting
224
+ `diff.statGraphWidth=<graph-width>`. Using `--stat` or
225
`--stat-graph-width` affects all commands generating a stat graph,
226
while setting `diff.statNameWidth` or `diff.statGraphWidth`
227
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.
228
+ By giving a third parameter _<count>_, you can limit the output to
229
+ the first _<count>_ lines, followed by `...` if there are more.
230
+
231
These parameters can also be set individually with `--stat-width=<width>`,
232
`--stat-name-width=<name-width>` and `--stat-count=<count>`.
233
233
---compact-summary::
234
+`--compact-summary`::
235
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
236
+ as file creations or deletions ("new" or "gone", optionally `+l`
237
+ if it's a symlink) and mode changes (`+x` or `-x` for adding
238
or removing executable bit respectively) in diffstat. The
239
information is put between the filename part and the graph
240
part. Implies `--stat`.
241
241
---numstat::
242
+`--numstat`::
243
Similar to `--stat`, but shows number of added and
244
deleted lines in decimal notation and pathname without
245
abbreviation, to make it more machine friendly. For
246
binary files, outputs two `-` instead of saying
247
`0 0`.
248
248
---shortstat::
249
+`--shortstat`::
250
Output only the last line of the `--stat` format containing total
251
number of modified files, as well as number of added and deleted
252
lines.
253
253
--X[<param1,param2,...>]::
254
---dirstat[=<param1,param2,...>]::
254
+`-X [<param>,...]`::
255
+`--dirstat[=<param>,...]`::
256
Output the distribution of relative amount of changes for each
257
sub-directory. The behavior of `--dirstat` can be customized by
258
passing it a comma separated list of parameters.
@@ -284,7 +285,7 @@ These parameters can also be set individually with `--stat-width=<width>`,
285
Note that when using `cumulative`, the sum of the percentages
286
reported may exceed 100%. The default (non-cumulative) behavior can
287
be specified with the `noncumulative` parameter.
287
-<limit>;;
288
+_<limit>_;;
289
An integer parameter specifies a cut-off percent (3% by default).
290
Directories contributing less than this percentage of the changes
291
are not shown in the output.
@@ -295,29 +296,29 @@ directories with less than 10% of the total amount of changed files,
296
and accumulating child directory counts in the parent directories:
297
`--dirstat=files,10,cumulative`.
298
298
---cumulative::
299
- Synonym for --dirstat=cumulative
299
+`--cumulative`::
300
+ Synonym for `--dirstat=cumulative`.
301
301
---dirstat-by-file[=<param1,param2>...]::
302
- Synonym for --dirstat=files,<param1>,<param2>...
302
+`--dirstat-by-file[=<param>,...]`::
303
+ Synonym for `--dirstat=files,<param>,...`.
304
304
---summary::
305
+`--summary`::
306
Output a condensed summary of extended header information
307
such as creations, renames and mode changes.
308
309
ifndef::git-format-patch[]
309
---patch-with-stat::
310
+`--patch-with-stat`::
311
Synonym for `-p --stat`.
312
endif::git-format-patch[]
313
314
ifndef::git-format-patch[]
315
315
--z::
316
+`-z`::
317
ifdef::git-log[]
317
- Separate the commits with NULs instead of newlines.
318
+ Separate the commits with __NUL__s instead of newlines.
319
+
320
Also, when `--raw` or `--numstat` has been given, do not munge
320
-pathnames and use NULs as output field terminators.
321
+pathnames and use __NUL__s as output field terminators.
322
endif::git-log[]
323
ifndef::git-log[]
324
When `--raw`, `--numstat`, `--name-only` or `--name-status` has been
@@ -328,89 +329,89 @@ Without this option, pathnames with "unusual" characters are quoted as
329
explained for the configuration variable `core.quotePath` (see
330
linkgit:git-config[1]).
331
331
---name-only::
332
+`--name-only`::
333
Show only the name of each changed file in the post-image tree.
334
The file names are often encoded in UTF-8.
335
For more information see the discussion about encoding in the linkgit:git-log[1]
336
manual page.
337
337
---name-status::
338
+`--name-status`::
339
Show only the name(s) and status of each changed file. See the description
340
of the `--diff-filter` option on what the status letters mean.
341
Just like `--name-only` the file names are often encoded in UTF-8.
342
342
---submodule[=<format>]::
343
+`--submodule[=<format>]`::
344
Specify how differences in submodules are shown. When specifying
344
- `--submodule=short` the 'short' format is used. This format just
345
+ `--submodule=short` the `short` format is used. This format just
346
shows the names of the commits at the beginning and end of the range.
346
- When `--submodule` or `--submodule=log` is specified, the 'log'
347
+ When `--submodule` or `--submodule=log` is specified, the `log`
348
format is used. This format lists the commits in the range like
349
linkgit:git-submodule[1] `summary` does. When `--submodule=diff`
349
- is specified, the 'diff' format is used. This format shows an
350
+ is specified, the `diff` format is used. This format shows an
351
inline diff of the changes in the submodule contents between the
351
- commit range. Defaults to `diff.submodule` or the 'short' format
352
+ commit range. Defaults to `diff.submodule` or the `short` format
353
if the config option is unset.
354
354
---color[=<when>]::
355
+`--color[=<when>]`::
356
Show colored diff.
356
- `--color` (i.e. without '=<when>') is the same as `--color=always`.
357
- '<when>' can be one of `always`, `never`, or `auto`.
357
+ `--color` (i.e. without `=<when>`) is the same as `--color=always`.
358
+ _<when>_ can be one of `always`, `never`, or `auto`.
359
ifdef::git-diff[]
360
It can be changed by the `color.ui` and `color.diff`
361
configuration settings.
362
endif::git-diff[]
363
363
---no-color::
364
+`--no-color`::
365
Turn off colored diff.
366
ifdef::git-diff[]
367
This can be used to override configuration settings.
368
endif::git-diff[]
369
It is the same as `--color=never`.
370
370
---color-moved[=<mode>]::
371
+`--color-moved[=<mode>]`::
372
Moved lines of code are colored differently.
373
ifdef::git-diff[]
374
It can be changed by the `diff.colorMoved` configuration setting.
375
endif::git-diff[]
375
- The <mode> defaults to 'no' if the option is not given
376
- and to 'zebra' if the option with no mode is given.
376
+ The _<mode>_ defaults to `no` if the option is not given
377
+ and to `zebra` if the option with no mode is given.
378
The mode must be one of:
379
+
380
--
380
-no::
381
+`no`::
382
Moved lines are not highlighted.
382
-default::
383
+`default`::
384
Is a synonym for `zebra`. This may change to a more sensible mode
385
in the future.
385
-plain::
386
+`plain`::
387
Any line that is added in one location and was removed
387
- in another location will be colored with 'color.diff.newMoved'.
388
- Similarly 'color.diff.oldMoved' will be used for removed lines
388
+ in another location will be colored with `color.diff.newMoved`.
389
+ Similarly `color.diff.oldMoved` will be used for removed lines
390
that are added somewhere else in the diff. This mode picks up any
391
moved line, but it is not very useful in a review to determine
392
if a block of code was moved without permutation.
392
-blocks::
393
+`blocks`::
394
Blocks of moved text of at least 20 alphanumeric characters
395
are detected greedily. The detected blocks are
395
- painted using either the 'color.diff.{old,new}Moved' color.
396
+ painted using either the `color.diff.(old|new)Moved` color.
397
Adjacent blocks cannot be told apart.
397
-zebra::
398
- Blocks of moved text are detected as in 'blocks' mode. The blocks
399
- are painted using either the 'color.diff.{old,new}Moved' color or
400
- 'color.diff.{old,new}MovedAlternative'. The change between
398
+`zebra`::
399
+ Blocks of moved text are detected as in `blocks` mode. The blocks
400
+ are painted using either the `color.diff.(old|new)Moved` color or
401
+ `color.diff.(old|new)MovedAlternative`. The change between
402
the two colors indicates that a new block was detected.
402
-dimmed-zebra::
403
- Similar to 'zebra', but additional dimming of uninteresting parts
403
+`dimmed-zebra`::
404
+ Similar to `zebra`, but additional dimming of uninteresting parts
405
of moved code is performed. The bordering lines of two adjacent
406
blocks are considered interesting, the rest is uninteresting.
407
`dimmed_zebra` is a deprecated synonym.
408
--
409
409
---no-color-moved::
410
+`--no-color-moved`::
411
Turn off move detection. This can be used to override configuration
412
settings. It is the same as `--color-moved=no`.
413
413
---color-moved-ws=<modes>::
414
+`--color-moved-ws=<mode>,...`::
415
This configures how whitespace is ignored when performing the
416
move detection for `--color-moved`.
417
ifdef::git-diff[]
@@ -419,63 +420,62 @@ endif::git-diff[]
420
These modes can be given as a comma separated list:
421
+
422
--
422
-no::
423
+`no`::
424
Do not ignore whitespace when performing move detection.
424
-ignore-space-at-eol::
425
+`ignore-space-at-eol`::
426
Ignore changes in whitespace at EOL.
426
-ignore-space-change::
427
+`ignore-space-change`::
428
Ignore changes in amount of whitespace. This ignores whitespace
429
at line end, and considers all other sequences of one or
430
more whitespace characters to be equivalent.
430
-ignore-all-space::
431
+`ignore-all-space`::
432
Ignore whitespace when comparing lines. This ignores differences
433
even if one line has whitespace where the other line has none.
433
-allow-indentation-change::
434
+`allow-indentation-change`::
435
Initially ignore any whitespace in the move detection, then
436
group the moved code blocks only into a block if the change in
437
whitespace is the same per line. This is incompatible with the
438
other modes.
439
--
440
440
---no-color-moved-ws::
441
+`--no-color-moved-ws`::
442
Do not ignore whitespace when performing move detection. This can be
443
used to override configuration settings. It is the same as
444
`--color-moved-ws=no`.
445
445
---word-diff[=<mode>]::
446
- Show a word diff, using the <mode> to delimit changed words.
446
+`--word-diff[=<mode>]`::
447
By default, words are delimited by whitespace; see
448
- `--word-diff-regex` below. The <mode> defaults to 'plain', and
448
+ `--word-diff-regex` below. The _<mode>_ defaults to `plain`, and
449
must be one of:
450
+
451
--
452
-color::
452
+`color`::
453
Highlight changed words using only colors. Implies `--color`.
454
-plain::
455
- Show words as `[-removed-]` and `{+added+}`. Makes no
454
+`plain`::
455
+ Show words as ++[-removed-]++ and ++{+added+}++. Makes no
456
attempts to escape the delimiters if they appear in the input,
457
so the output may be ambiguous.
458
-porcelain::
458
+`porcelain`::
459
Use a special line-based format intended for script
460
consumption. Added/removed/unchanged runs are printed in the
461
usual unified diff format, starting with a `+`/`-`/` `
462
character at the beginning of the line and extending to the
463
end of the line. Newlines in the input are represented by a
464
tilde `~` on a line of its own.
465
-none::
465
+`none`::
466
Disable word diff again.
467
--
468
+
469
Note that despite the name of the first mode, color is used to
470
highlight the changed parts in all modes if enabled.
471
472
---word-diff-regex=<regex>::
473
- Use <regex> to decide what a word is, instead of considering
472
+`--word-diff-regex=<regex>`::
473
+ Use _<regex>_ to decide what a word is, instead of considering
474
runs of non-whitespace to be a word. Also implies
475
`--word-diff` unless it was already enabled.
476
+
477
Every non-overlapping match of the
478
-<regex> is considered a word. Anything between these matches is
478
+_<regex>_ is considered a word. Anything between these matches is
479
considered whitespace and ignored(!) for the purposes of finding
480
differences. You may want to append `|[^[:space:]]` to your regular
481
expression to make sure that it matches all non-whitespace characters.
@@ -490,20 +490,20 @@ linkgit:gitattributes[5] or linkgit:git-config[1]. Giving it explicitly
490
overrides any diff driver or configuration setting. Diff drivers
491
override configuration settings.
492
493
---color-words[=<regex>]::
493
+`--color-words[=<regex>]`::
494
Equivalent to `--word-diff=color` plus (if a regex was
495
specified) `--word-diff-regex=<regex>`.
496
endif::git-format-patch[]
497
498
---no-renames::
498
+`--no-renames`::
499
Turn off rename detection, even when the configuration
500
file gives the default to do so.
501
502
---[no-]rename-empty::
502
+`--[no-]rename-empty`::
503
Whether to use empty blobs as rename source.
504
505
ifndef::git-format-patch[]
506
---check::
506
+`--check`::
507
Warn if changes introduce conflict markers or whitespace errors.
508
What are considered whitespace errors is controlled by `core.whitespace`
509
configuration. By default, trailing whitespaces (including
@@ -511,9 +511,9 @@ ifndef::git-format-patch[]
511
that is immediately followed by a tab character inside the
512
initial indent of the line are considered whitespace errors.
513
Exits with non-zero status if problems are found. Not compatible
514
- with --exit-code.
514
+ with `--exit-code`.
515
516
---ws-error-highlight=<kind>::
516
+`--ws-error-highlight=<kind>`::
517
Highlight whitespace errors in the `context`, `old` or `new`
518
lines of the diff. Multiple values are separated by comma,
519
`none` resets previous values, `default` reset the list to
@@ -525,30 +525,30 @@ ifndef::git-format-patch[]
525
526
endif::git-format-patch[]
527
528
---full-index::
528
+`--full-index`::
529
Instead of the first handful of characters, show the full
530
pre- and post-image blob object names on the "index"
531
line when generating patch format output.
532
533
---binary::
533
+`--binary`::
534
In addition to `--full-index`, output a binary diff that
535
can be applied with `git-apply`.
536
ifndef::git-format-patch[]
537
Implies `--patch`.
538
endif::git-format-patch[]
539
540
---abbrev[=<n>]::
540
+`--abbrev[=<n>]`::
541
Instead of showing the full 40-byte hexadecimal object
542
name in diff-raw format output and diff-tree header
543
- lines, show the shortest prefix that is at least '<n>'
543
+ lines, show the shortest prefix that is at least _<n>_
544
hexdigits long that uniquely refers the object.
545
In diff-patch output format, `--full-index` takes higher
546
precedence, i.e. if `--full-index` is specified, full blob
547
names will be shown regardless of `--abbrev`.
548
Non default number of digits can be specified with `--abbrev=<n>`.
549
550
--B[<n>][/<m>]::
551
---break-rewrites[=[<n>][/<m>]]::
550
+`-B[<n>][/<m>]`::
551
+`--break-rewrites[=[<n>][/<m>]]`::
552
Break complete rewrite changes into pairs of delete and
553
create. This serves two purposes:
554
+
@@ -556,22 +556,22 @@ It affects the way a change that amounts to a total rewrite of a file
556
not as a series of deletion and insertion mixed together with a very
557
few lines that happen to match textually as the context, but as a
558
single deletion of everything old followed by a single insertion of
559
-everything new, and the number `m` controls this aspect of the -B
559
+everything new, and the number _<m>_ controls this aspect of the `-B`
560
option (defaults to 60%). `-B/70%` specifies that less than 30% of the
561
original should remain in the result for Git to consider it a total
562
rewrite (i.e. otherwise the resulting patch will be a series of
563
deletion and insertion mixed together with context lines).
564
+
565
-When used with -M, a totally-rewritten file is also considered as the
566
-source of a rename (usually -M only considers a file that disappeared
567
-as the source of a rename), and the number `n` controls this aspect of
568
-the -B option (defaults to 50%). `-B20%` specifies that a change with
565
+When used with `-M`, a totally-rewritten file is also considered as the
566
+source of a rename (usually `-M` only considers a file that disappeared
567
+as the source of a rename), and the number _<n>_ controls this aspect of
568
+the `-B` option (defaults to 50%). `-B20%` specifies that a change with
569
addition and deletion compared to 20% or more of the file's size are
570
eligible for being picked up as a possible source of a rename to
571
another file.
572
573
--M[<n>]::
574
---find-renames[=<n>]::
573
+`-M[<n>]`::
574
+`--find-renames[=<n>]`::
575
ifndef::git-log[]
576
Detect renames.
577
endif::git-log[]
@@ -580,7 +580,7 @@ ifdef::git-log[]
580
For following files across renames while traversing history, see
581
`--follow`.
582
endif::git-log[]
583
- If `n` is specified, it is a threshold on the similarity
583
+ If _<n>_ is specified, it is a threshold on the similarity
584
index (i.e. amount of addition/deletions compared to the
585
file's size). For example, `-M90%` means Git should consider a
586
delete/add pair to be a rename if more than 90% of the file
@@ -590,12 +590,12 @@ endif::git-log[]
590
the same as `-M5%`. To limit detection to exact renames, use
591
`-M100%`. The default similarity index is 50%.
592
593
--C[<n>]::
594
---find-copies[=<n>]::
593
+`-C[<n>]`::
594
+`--find-copies[=<n>]`::
595
Detect copies as well as renames. See also `--find-copies-harder`.
596
- If `n` is specified, it has the same meaning as for `-M<n>`.
596
+ If _<n>_ is specified, it has the same meaning as for `-M<n>`.
597
598
---find-copies-harder::
598
+`--find-copies-harder`::
599
For performance reasons, by default, `-C` option finds copies only
600
if the original file of the copy was modified in the same
601
changeset. This flag makes the command
@@ -604,8 +604,8 @@ endif::git-log[]
604
projects, so use it with caution. Giving more than one
605
`-C` option has the same effect.
606
607
--D::
608
---irreversible-delete::
607
+`-D`::
608
+`--irreversible-delete`::
609
Omit the preimage for deletes, i.e. print only the header but not
610
the diff between the preimage and `/dev/null`. The resulting patch
611
is not meant to be applied with `patch` or `git apply`; this is
@@ -617,7 +617,7 @@ endif::git-log[]
617
When used together with `-B`, omit also the preimage in the deletion part
618
of a delete/create pair.
619
620
--l<num>::
620
+`-l<num>`::
621
The `-M` and `-C` options involve some preliminary steps that
622
can detect subsets of renames/copies cheaply, followed by an
623
exhaustive fallback portion that compares all remaining
@@ -627,11 +627,11 @@ of a delete/create pair.
627
destinations, this exhaustive check is O(N^2). This option
628
prevents the exhaustive portion of rename/copy detection from
629
running if the number of source/destination files involved
630
- exceeds the specified number. Defaults to diff.renameLimit.
630
+ exceeds the specified number. Defaults to `diff.renameLimit`.
631
Note that a value of 0 is treated as unlimited.
632
633
ifndef::git-format-patch[]
634
---diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
634
+`--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]`::
635
Select only files that are Added (`A`), Copied (`C`),
636
Deleted (`D`), Modified (`M`), Renamed (`R`), have their
637
type (i.e. regular file, symlink, submodule, ...) changed (`T`),
@@ -649,9 +649,9 @@ Also, these upper-case letters can be downcased to exclude. E.g.
649
Note that not all diffs can feature all types. For instance, copied and
650
renamed entries cannot appear if detection for those types is disabled.
651
652
--S<string>::
652
+`-S<string>`::
653
Look for differences that change the number of occurrences of
654
- the specified string (i.e. addition/deletion) in a file.
654
+ the specified _<string>_ (i.e. addition/deletion) in a file.
655
Intended for the scripter's use.
656
+
657
It is useful when you're looking for an exact block of code (like a
@@ -662,11 +662,11 @@ very first version of the block.
662
+
663
Binary files are searched as well.
664
665
--G<regex>::
665
+`-G<regex>`::
666
Look for differences whose patch text contains added/removed
667
- lines that match <regex>.
667
+ lines that match _<regex>_.
668
+
669
-To illustrate the difference between `-S<regex> --pickaxe-regex` and
669
+To illustrate the difference between `-S<regex>` `--pickaxe-regex` and
670
`-G<regex>`, consider a commit with the following diff in the same
671
file:
672
+
@@ -686,7 +686,7 @@ filter will be ignored.
686
See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more
687
information.
688
689
---find-object=<object-id>::
689
+`--find-object=<object-id>`::
690
Look for differences that change the number of occurrences of
691
the specified object. Similar to `-S`, just the argument is different
692
in that it doesn't search for a specific string but for a specific
@@ -695,25 +695,25 @@ information.
695
The object can be a blob or a submodule commit. It implies the `-t` option in
696
`git-log` to also find trees.
697
698
---pickaxe-all::
698
+`--pickaxe-all`::
699
When `-S` or `-G` finds a change, show all the changes in that
700
changeset, not just the files that contain the change
701
- in <string>.
701
+ in _<string>_.
702
703
---pickaxe-regex::
704
- Treat the <string> given to `-S` as an extended POSIX regular
703
+`--pickaxe-regex`::
704
+ Treat the _<string>_ given to `-S` as an extended POSIX regular
705
expression to match.
706
707
endif::git-format-patch[]
708
709
--O<orderfile>::
709
+`-O<orderfile>`::
710
Control the order in which files appear in the output.
711
This overrides the `diff.orderFile` configuration variable
712
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
713
use `-O/dev/null`.
714
+
715
The output order is determined by the order of glob patterns in
716
-<orderfile>.
716
+_<orderfile>_.
717
All files with pathnames that match the first pattern are output
718
first, all files with pathnames that match the second pattern (but not
719
the first) are output next, and so on.
@@ -724,7 +724,7 @@ If multiple pathnames have the same rank (they match the same pattern
724
but no earlier patterns), their output order relative to each other is
725
the normal order.
726
+
727
-<orderfile> is parsed as follows:
727
+_<orderfile>_ is parsed as follows:
728
+
729
--
730
- Blank lines are ignored, so they can be used as separators for
@@ -738,106 +738,107 @@ the normal order.
738
--
739
+
740
Patterns have the same syntax and semantics as patterns used for
741
-fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
741
+`fnmatch`(3) without the `FNM_PATHNAME` flag, except a pathname also
742
matches a pattern if removing any number of the final pathname
743
components matches the pattern. For example, the pattern "`foo*bar`"
744
matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
745
746
---skip-to=<file>::
747
---rotate-to=<file>::
748
- Discard the files before the named <file> from the output
746
+`--skip-to=<file>`::
747
+`--rotate-to=<file>`::
748
+ Discard the files before the named _<file>_ from the output
749
(i.e. 'skip to'), or move them to the end of the output
750
(i.e. 'rotate to'). These options were invented primarily for the use
751
of the `git difftool` command, and may not be very useful
752
otherwise.
753
754
ifndef::git-format-patch[]
755
--R::
755
+`-R`::
756
Swap two inputs; that is, show differences from index or
757
on-disk file to tree contents.
758
endif::git-format-patch[]
759
760
---relative[=<path>]::
761
---no-relative::
760
+`--relative[=<path>]`::
761
+`--no-relative`::
762
When run from a subdirectory of the project, it can be
763
told to exclude changes outside the directory and show
764
pathnames relative to it with this option. When you are
765
not in a subdirectory (e.g. in a bare repository), you
766
can name which subdirectory to make the output relative
767
- to by giving a <path> as an argument.
767
+ to by giving a _<path>_ as an argument.
768
`--no-relative` can be used to countermand both `diff.relative` config
769
option and previous `--relative`.
770
771
--a::
772
---text::
771
+`-a`::
772
+`--text`::
773
Treat all files as text.
774
775
---ignore-cr-at-eol::
775
+`--ignore-cr-at-eol`::
776
Ignore carriage-return at the end of line when doing a comparison.
777
778
---ignore-space-at-eol::
778
+`--ignore-space-at-eol`::
779
Ignore changes in whitespace at EOL.
780
781
--b::
782
---ignore-space-change::
781
+`-b`::
782
+`--ignore-space-change`::
783
Ignore changes in amount of whitespace. This ignores whitespace
784
at line end, and considers all other sequences of one or
785
more whitespace characters to be equivalent.
786
787
--w::
788
---ignore-all-space::
787
+`-w`::
788
+`--ignore-all-space`::
789
Ignore whitespace when comparing lines. This ignores
790
differences even if one line has whitespace where the other
791
line has none.
792
793
---ignore-blank-lines::
793
+`--ignore-blank-lines`::
794
Ignore changes whose lines are all blank.
795
796
--I<regex>::
797
---ignore-matching-lines=<regex>::
798
- Ignore changes whose all lines match <regex>. This option may
796
+
797
+`-I<regex>`::
798
+`--ignore-matching-lines=<regex>`::
799
+ Ignore changes whose all lines match _<regex>_. This option may
800
be specified more than once.
801
801
---inter-hunk-context=<lines>::
802
- Show the context between diff hunks, up to the specified number
802
+`--inter-hunk-context=<number>`::
803
+ Show the context between diff hunks, up to the specified _<number>_
804
of lines, thereby fusing hunks that are close to each other.
805
Defaults to `diff.interHunkContext` or 0 if the config option
806
is unset.
807
807
--W::
808
---function-context::
808
+`-W`::
809
+`--function-context`::
810
Show whole function as context lines for each change.
811
The function names are determined in the same way as
811
- `git diff` works out patch hunk headers (see 'Defining a
812
- custom hunk-header' in linkgit:gitattributes[5]).
812
+ `git diff` works out patch hunk headers (see "Defining a
813
+ custom hunk-header" in linkgit:gitattributes[5]).
814
815
ifndef::git-format-patch[]
816
ifndef::git-log[]
816
---exit-code::
817
- Make the program exit with codes similar to diff(1).
817
+`--exit-code`::
818
+ Make the program exit with codes similar to `diff`(1).
819
That is, it exits with 1 if there were differences and
820
0 means no differences.
821
821
---quiet::
822
+`--quiet`::
823
Disable all output of the program. Implies `--exit-code`.
824
Disables execution of external diff helpers whose exit code
825
is not trusted, i.e. their respective configuration option
825
- `diff.trustExitCode` or `diff.<driver>.trustExitCode` or
826
+ `diff.trustExitCode` or ++diff.++__<driver>__++.trustExitCode++ or
827
environment variable `GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE` is
828
false.
829
endif::git-log[]
830
endif::git-format-patch[]
831
831
---ext-diff::
832
+`--ext-diff`::
833
Allow an external diff helper to be executed. If you set an
834
external diff driver with linkgit:gitattributes[5], you need
835
to use this option with linkgit:git-log[1] and friends.
836
836
---no-ext-diff::
837
+`--no-ext-diff`::
838
Disallow external diff drivers.
839
839
---textconv::
840
---no-textconv::
840
+`--textconv`::
841
+`--no-textconv`::
842
Allow (or disallow) external text conversion filters to be run
843
when comparing binary files. See linkgit:gitattributes[5] for
844
details. Because textconv filters are typically a one-way
@@ -847,42 +848,42 @@ endif::git-format-patch[]
848
linkgit:git-log[1], but not for linkgit:git-format-patch[1] or
849
diff plumbing commands.
850
850
---ignore-submodules[=<when>]::
851
- Ignore changes to submodules in the diff generation. <when> can be
852
- either "none", "untracked", "dirty" or "all", which is the default.
853
- Using "none" will consider the submodule modified when it either contains
854
- untracked or modified files or its HEAD differs from the commit recorded
851
+
852
+`--ignore-submodules[=(none|untracked|dirty|all)]`::
853
+ Ignore changes to submodules in the diff generation. `all` is the default.
854
+ Using `none` will consider the submodule modified when it either contains
855
+ untracked or modified files or its `HEAD` differs from the commit recorded
856
in the superproject and can be used to override any settings of the
856
- 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
857
- "untracked" is used submodules are not considered dirty when they only
857
+ `ignore` option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
858
+ `untracked` is used submodules are not considered dirty when they only
859
contain untracked content (but they are still scanned for modified
859
- content). Using "dirty" ignores all changes to the work tree of submodules,
860
+ content). Using `dirty` ignores all changes to the work tree of submodules,
861
only changes to the commits stored in the superproject are shown (this was
861
- the behavior until 1.7.0). Using "all" hides all changes to submodules.
862
+ the behavior until 1.7.0). Using `all` hides all changes to submodules.
863
863
---src-prefix=<prefix>::
864
- Show the given source prefix instead of "a/".
864
+`--src-prefix=<prefix>`::
865
+ Show the given source _<prefix>_ instead of "a/".
866
866
---dst-prefix=<prefix>::
867
- Show the given destination prefix instead of "b/".
867
+`--dst-prefix=<prefix>`::
868
+ Show the given destination _<prefix>_ instead of "b/".
869
869
---no-prefix::
870
+`--no-prefix`::
871
Do not show any source or destination prefix.
872
872
---default-prefix::
873
+`--default-prefix`::
874
Use the default source and destination prefixes ("a/" and "b/").
875
This overrides configuration variables such as `diff.noprefix`,
876
`diff.srcPrefix`, `diff.dstPrefix`, and `diff.mnemonicPrefix`
876
- (see `git-config`(1)).
877
+ (see linkgit:git-config[1]).
878
878
---line-prefix=<prefix>::
879
- Prepend an additional prefix to every line of output.
879
+`--line-prefix=<prefix>`::
880
+ Prepend an additional _<prefix>_ to every line of output.
881
881
---ita-invisible-in-index::
882
- By default entries added by "git add -N" appear as an existing
883
- empty file in "git diff" and a new file in "git diff --cached".
884
- This option makes the entry appear as a new file in "git diff"
885
- and non-existent in "git diff --cached". This option could be
882
+`--ita-invisible-in-index`::
883
+ By default entries added by `git add -N` appear as an existing
884
+ empty file in `git diff` and a new file in `git diff --cached`.
885
+ This option makes the entry appear as a new file in `git diff`
886
+ and non-existent in `git diff --cached`. This option could be
887
reverted with `--ita-visible-in-index`. Both options are
888
experimental and could be removed in future.
889