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