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