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