difftool: refactor dir-diff to write files using helper functions
[git/debian.git] / Documentation / diff-options.txt
blobc89d530d3d1d39dbed0a46b3fa3f6def92ed7def
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.
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[]
15 ifdef::git-format-patch[]
16 -p::
17 --no-stat::
18         Generate plain patches without any diffstats.
19 endif::git-format-patch[]
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[]
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[]
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.
43 --diff-merges=(off|none):::
44 --no-diff-merges:::
45         Disable output of diffs for merge commits. Useful to override
46         implied value.
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`.
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.
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.
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`.
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`.
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[]
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[]
102 --output=<file>::
103         Output to a specific file instead of stdout.
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.
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[]
129 ifndef::git-format-patch[]
130 --patch-with-raw::
131         Synonym for `-p --raw`.
132 endif::git-format-patch[]
134 ifdef::git-log[]
135 -t::
136         Show the tree objects in the diff output.
137 endif::git-log[]
139 --indent-heuristic::
140         Enable the heuristic that shifts diff hunk boundaries to make patches
141         easier to read. This is the default.
143 --no-indent-heuristic::
144         Disable the indent heuristic.
146 --minimal::
147         Spend extra time to make sure the smallest possible
148         diff is produced.
150 --patience::
151         Generate a diff using the "patience diff" algorithm.
153 --histogram::
154         Generate a diff using the "histogram diff" algorithm.
156 --anchored=<text>::
157         Generate a diff using the "anchored diff" algorithm.
159 This option may be specified more than once.
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.
166 --diff-algorithm={patience|minimal|histogram|myers}::
167         Choose a diff algorithm. The variants are as follows:
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".
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.
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.
201 These parameters can also be set individually with `--stat-width=<width>`,
202 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
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`.
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`.
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.
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:
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.
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`.
269 --cumulative::
270         Synonym for --dirstat=cumulative
272 --dirstat-by-file[=<param1,param2>...]::
273         Synonym for --dirstat=files,param1,param2...
275 --summary::
276         Output a condensed summary of extended header information
277         such as creations, renames and mode changes.
279 ifndef::git-format-patch[]
280 --patch-with-stat::
281         Synonym for `-p --stat`.
282 endif::git-format-patch[]
284 ifndef::git-format-patch[]
286 -z::
287 ifdef::git-log[]
288         Separate the commits with NULs instead of with new newlines.
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[]
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]).
302 --name-only::
303         Show only names of changed files. The file names are often encoded in UTF-8.
304         For more information see the discussion about encoding in the linkgit:git-log[1]
305         manual page.
307 --name-status::
308         Show only names and status of changed files. See the description
309         of the `--diff-filter` option on what the status letters mean.
310         Just like `--name-only` the file names are often encoded in UTF-8.
312 --submodule[=<format>]::
313         Specify how differences in submodules are shown.  When specifying
314         `--submodule=short` the 'short' format is used.  This format just
315         shows the names of the commits at the beginning and end of the range.
316         When `--submodule` or `--submodule=log` is specified, the 'log'
317         format is used.  This format lists the commits in the range like
318         linkgit:git-submodule[1] `summary` does.  When `--submodule=diff`
319         is specified, the 'diff' format is used.  This format shows an
320         inline diff of the changes in the submodule contents between the
321         commit range.  Defaults to `diff.submodule` or the 'short' format
322         if the config option is unset.
324 --color[=<when>]::
325         Show colored diff.
326         `--color` (i.e. without '=<when>') is the same as `--color=always`.
327         '<when>' can be one of `always`, `never`, or `auto`.
328 ifdef::git-diff[]
329         It can be changed by the `color.ui` and `color.diff`
330         configuration settings.
331 endif::git-diff[]
333 --no-color::
334         Turn off colored diff.
335 ifdef::git-diff[]
336         This can be used to override configuration settings.
337 endif::git-diff[]
338         It is the same as `--color=never`.
340 --color-moved[=<mode>]::
341         Moved lines of code are colored differently.
342 ifdef::git-diff[]
343         It can be changed by the `diff.colorMoved` configuration setting.
344 endif::git-diff[]
345         The <mode> defaults to 'no' if the option is not given
346         and to 'zebra' if the option with no mode is given.
347         The mode must be one of:
350 no::
351         Moved lines are not highlighted.
352 default::
353         Is a synonym for `zebra`. This may change to a more sensible mode
354         in the future.
355 plain::
356         Any line that is added in one location and was removed
357         in another location will be colored with 'color.diff.newMoved'.
358         Similarly 'color.diff.oldMoved' will be used for removed lines
359         that are added somewhere else in the diff. This mode picks up any
360         moved line, but it is not very useful in a review to determine
361         if a block of code was moved without permutation.
362 blocks::
363         Blocks of moved text of at least 20 alphanumeric characters
364         are detected greedily. The detected blocks are
365         painted using either the 'color.diff.{old,new}Moved' color.
366         Adjacent blocks cannot be told apart.
367 zebra::
368         Blocks of moved text are detected as in 'blocks' mode. The blocks
369         are painted using either the 'color.diff.{old,new}Moved' color or
370         'color.diff.{old,new}MovedAlternative'. The change between
371         the two colors indicates that a new block was detected.
372 dimmed-zebra::
373         Similar to 'zebra', but additional dimming of uninteresting parts
374         of moved code is performed. The bordering lines of two adjacent
375         blocks are considered interesting, the rest is uninteresting.
376         `dimmed_zebra` is a deprecated synonym.
379 --no-color-moved::
380         Turn off move detection. This can be used to override configuration
381         settings. It is the same as `--color-moved=no`.
383 --color-moved-ws=<modes>::
384         This configures how whitespace is ignored when performing the
385         move detection for `--color-moved`.
386 ifdef::git-diff[]
387         It can be set by the `diff.colorMovedWS` configuration setting.
388 endif::git-diff[]
389         These modes can be given as a comma separated list:
392 no::
393         Do not ignore whitespace when performing move detection.
394 ignore-space-at-eol::
395         Ignore changes in whitespace at EOL.
396 ignore-space-change::
397         Ignore changes in amount of whitespace.  This ignores whitespace
398         at line end, and considers all other sequences of one or
399         more whitespace characters to be equivalent.
400 ignore-all-space::
401         Ignore whitespace when comparing lines. This ignores differences
402         even if one line has whitespace where the other line has none.
403 allow-indentation-change::
404         Initially ignore any whitespace in the move detection, then
405         group the moved code blocks only into a block if the change in
406         whitespace is the same per line. This is incompatible with the
407         other modes.
410 --no-color-moved-ws::
411         Do not ignore whitespace when performing move detection. This can be
412         used to override configuration settings. It is the same as
413         `--color-moved-ws=no`.
415 --word-diff[=<mode>]::
416         Show a word diff, using the <mode> to delimit changed words.
417         By default, words are delimited by whitespace; see
418         `--word-diff-regex` below.  The <mode> defaults to 'plain', and
419         must be one of:
422 color::
423         Highlight changed words using only colors.  Implies `--color`.
424 plain::
425         Show words as `[-removed-]` and `{+added+}`.  Makes no
426         attempts to escape the delimiters if they appear in the input,
427         so the output may be ambiguous.
428 porcelain::
429         Use a special line-based format intended for script
430         consumption.  Added/removed/unchanged runs are printed in the
431         usual unified diff format, starting with a `+`/`-`/` `
432         character at the beginning of the line and extending to the
433         end of the line.  Newlines in the input are represented by a
434         tilde `~` on a line of its own.
435 none::
436         Disable word diff again.
439 Note that despite the name of the first mode, color is used to
440 highlight the changed parts in all modes if enabled.
442 --word-diff-regex=<regex>::
443         Use <regex> to decide what a word is, instead of considering
444         runs of non-whitespace to be a word.  Also implies
445         `--word-diff` unless it was already enabled.
447 Every non-overlapping match of the
448 <regex> is considered a word.  Anything between these matches is
449 considered whitespace and ignored(!) for the purposes of finding
450 differences.  You may want to append `|[^[:space:]]` to your regular
451 expression to make sure that it matches all non-whitespace characters.
452 A match that contains a newline is silently truncated(!) at the
453 newline.
455 For example, `--word-diff-regex=.` will treat each character as a word
456 and, correspondingly, show differences character by character.
458 The regex can also be set via a diff driver or configuration option, see
459 linkgit:gitattributes[5] or linkgit:git-config[1].  Giving it explicitly
460 overrides any diff driver or configuration setting.  Diff drivers
461 override configuration settings.
463 --color-words[=<regex>]::
464         Equivalent to `--word-diff=color` plus (if a regex was
465         specified) `--word-diff-regex=<regex>`.
466 endif::git-format-patch[]
468 --no-renames::
469         Turn off rename detection, even when the configuration
470         file gives the default to do so.
472 --[no-]rename-empty::
473         Whether to use empty blobs as rename source.
475 ifndef::git-format-patch[]
476 --check::
477         Warn if changes introduce conflict markers or whitespace errors.
478         What are considered whitespace errors is controlled by `core.whitespace`
479         configuration.  By default, trailing whitespaces (including
480         lines that consist solely of whitespaces) and a space character
481         that is immediately followed by a tab character inside the
482         initial indent of the line are considered whitespace errors.
483         Exits with non-zero status if problems are found. Not compatible
484         with --exit-code.
486 --ws-error-highlight=<kind>::
487         Highlight whitespace errors in the `context`, `old` or `new`
488         lines of the diff.  Multiple values are separated by comma,
489         `none` resets previous values, `default` reset the list to
490         `new` and `all` is a shorthand for `old,new,context`.  When
491         this option is not given, and the configuration variable
492         `diff.wsErrorHighlight` is not set, only whitespace errors in
493         `new` lines are highlighted. The whitespace errors are colored
494         with `color.diff.whitespace`.
496 endif::git-format-patch[]
498 --full-index::
499         Instead of the first handful of characters, show the full
500         pre- and post-image blob object names on the "index"
501         line when generating patch format output.
503 --binary::
504         In addition to `--full-index`, output a binary diff that
505         can be applied with `git-apply`.
506 ifndef::git-format-patch[]
507         Implies `--patch`.
508 endif::git-format-patch[]
510 --abbrev[=<n>]::
511         Instead of showing the full 40-byte hexadecimal object
512         name in diff-raw format output and diff-tree header
513         lines, show the shortest prefix that is at least '<n>'
514         hexdigits long that uniquely refers the object.
515         In diff-patch output format, `--full-index` takes higher
516         precedence, i.e. if `--full-index` is specified, full blob
517         names will be shown regardless of `--abbrev`.
518         Non default number of digits can be specified with `--abbrev=<n>`.
520 -B[<n>][/<m>]::
521 --break-rewrites[=[<n>][/<m>]]::
522         Break complete rewrite changes into pairs of delete and
523         create. This serves two purposes:
525 It affects the way a change that amounts to a total rewrite of a file
526 not as a series of deletion and insertion mixed together with a very
527 few lines that happen to match textually as the context, but as a
528 single deletion of everything old followed by a single insertion of
529 everything new, and the number `m` controls this aspect of the -B
530 option (defaults to 60%). `-B/70%` specifies that less than 30% of the
531 original should remain in the result for Git to consider it a total
532 rewrite (i.e. otherwise the resulting patch will be a series of
533 deletion and insertion mixed together with context lines).
535 When used with -M, a totally-rewritten file is also considered as the
536 source of a rename (usually -M only considers a file that disappeared
537 as the source of a rename), and the number `n` controls this aspect of
538 the -B option (defaults to 50%). `-B20%` specifies that a change with
539 addition and deletion compared to 20% or more of the file's size are
540 eligible for being picked up as a possible source of a rename to
541 another file.
543 -M[<n>]::
544 --find-renames[=<n>]::
545 ifndef::git-log[]
546         Detect renames.
547 endif::git-log[]
548 ifdef::git-log[]
549         If generating diffs, detect and report renames for each commit.
550         For following files across renames while traversing history, see
551         `--follow`.
552 endif::git-log[]
553         If `n` is specified, it is a threshold on the similarity
554         index (i.e. amount of addition/deletions compared to the
555         file's size). For example, `-M90%` means Git should consider a
556         delete/add pair to be a rename if more than 90% of the file
557         hasn't changed.  Without a `%` sign, the number is to be read as
558         a fraction, with a decimal point before it.  I.e., `-M5` becomes
559         0.5, and is thus the same as `-M50%`.  Similarly, `-M05` is
560         the same as `-M5%`.  To limit detection to exact renames, use
561         `-M100%`.  The default similarity index is 50%.
563 -C[<n>]::
564 --find-copies[=<n>]::
565         Detect copies as well as renames.  See also `--find-copies-harder`.
566         If `n` is specified, it has the same meaning as for `-M<n>`.
568 --find-copies-harder::
569         For performance reasons, by default, `-C` option finds copies only
570         if the original file of the copy was modified in the same
571         changeset.  This flag makes the command
572         inspect unmodified files as candidates for the source of
573         copy.  This is a very expensive operation for large
574         projects, so use it with caution.  Giving more than one
575         `-C` option has the same effect.
577 -D::
578 --irreversible-delete::
579         Omit the preimage for deletes, i.e. print only the header but not
580         the diff between the preimage and `/dev/null`. The resulting patch
581         is not meant to be applied with `patch` or `git apply`; this is
582         solely for people who want to just concentrate on reviewing the
583         text after the change. In addition, the output obviously lacks
584         enough information to apply such a patch in reverse, even manually,
585         hence the name of the option.
587 When used together with `-B`, omit also the preimage in the deletion part
588 of a delete/create pair.
590 -l<num>::
591         The `-M` and `-C` options involve some preliminary steps that
592         can detect subsets of renames/copies cheaply, followed by an
593         exhaustive fallback portion that compares all remaining
594         unpaired destinations to all relevant sources.  (For renames,
595         only remaining unpaired sources are relevant; for copies, all
596         original sources are relevant.)  For N sources and
597         destinations, this exhaustive check is O(N^2).  This option
598         prevents the exhaustive portion of rename/copy detection from
599         running if the number of source/destination files involved
600         exceeds the specified number.  Defaults to diff.renameLimit.
601         Note that a value of 0 is treated as unlimited.
603 ifndef::git-format-patch[]
604 --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
605         Select only files that are Added (`A`), Copied (`C`),
606         Deleted (`D`), Modified (`M`), Renamed (`R`), have their
607         type (i.e. regular file, symlink, submodule, ...) changed (`T`),
608         are Unmerged (`U`), are
609         Unknown (`X`), or have had their pairing Broken (`B`).
610         Any combination of the filter characters (including none) can be used.
611         When `*` (All-or-none) is added to the combination, all
612         paths are selected if there is any file that matches
613         other criteria in the comparison; if there is no file
614         that matches other criteria, nothing is selected.
616 Also, these upper-case letters can be downcased to exclude.  E.g.
617 `--diff-filter=ad` excludes added and deleted paths.
619 Note that not all diffs can feature all types. For instance, diffs
620 from the index to the working tree can never have Added entries
621 (because the set of paths included in the diff is limited by what is in
622 the index).  Similarly, copied and renamed entries cannot appear if
623 detection for those types is disabled.
625 -S<string>::
626         Look for differences that change the number of occurrences of
627         the specified string (i.e. addition/deletion) in a file.
628         Intended for the scripter's use.
630 It is useful when you're looking for an exact block of code (like a
631 struct), and want to know the history of that block since it first
632 came into being: use the feature iteratively to feed the interesting
633 block in the preimage back into `-S`, and keep going until you get the
634 very first version of the block.
636 Binary files are searched as well.
638 -G<regex>::
639         Look for differences whose patch text contains added/removed
640         lines that match <regex>.
642 To illustrate the difference between `-S<regex> --pickaxe-regex` and
643 `-G<regex>`, consider a commit with the following diff in the same
644 file:
646 ----
647 +    return frotz(nitfol, two->ptr, 1, 0);
649 -    hit = frotz(nitfol, mf2.ptr, 1, 0);
650 ----
652 While `git log -G"frotz\(nitfol"` will show this commit, `git log
653 -S"frotz\(nitfol" --pickaxe-regex` will not (because the number of
654 occurrences of that string did not change).
656 Unless `--text` is supplied patches of binary files without a textconv
657 filter will be ignored.
659 See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more
660 information.
662 --find-object=<object-id>::
663         Look for differences that change the number of occurrences of
664         the specified object. Similar to `-S`, just the argument is different
665         in that it doesn't search for a specific string but for a specific
666         object id.
668 The object can be a blob or a submodule commit. It implies the `-t` option in
669 `git-log` to also find trees.
671 --pickaxe-all::
672         When `-S` or `-G` finds a change, show all the changes in that
673         changeset, not just the files that contain the change
674         in <string>.
676 --pickaxe-regex::
677         Treat the <string> given to `-S` as an extended POSIX regular
678         expression to match.
680 endif::git-format-patch[]
682 -O<orderfile>::
683         Control the order in which files appear in the output.
684         This overrides the `diff.orderFile` configuration variable
685         (see linkgit:git-config[1]).  To cancel `diff.orderFile`,
686         use `-O/dev/null`.
688 The output order is determined by the order of glob patterns in
689 <orderfile>.
690 All files with pathnames that match the first pattern are output
691 first, all files with pathnames that match the second pattern (but not
692 the first) are output next, and so on.
693 All files with pathnames that do not match any pattern are output
694 last, as if there was an implicit match-all pattern at the end of the
695 file.
696 If multiple pathnames have the same rank (they match the same pattern
697 but no earlier patterns), their output order relative to each other is
698 the normal order.
700 <orderfile> is parsed as follows:
703  - Blank lines are ignored, so they can be used as separators for
704    readability.
706  - Lines starting with a hash ("`#`") are ignored, so they can be used
707    for comments.  Add a backslash ("`\`") to the beginning of the
708    pattern if it starts with a hash.
710  - Each other line contains a single pattern.
713 Patterns have the same syntax and semantics as patterns used for
714 fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
715 matches a pattern if removing any number of the final pathname
716 components matches the pattern.  For example, the pattern "`foo*bar`"
717 matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
719 --skip-to=<file>::
720 --rotate-to=<file>::
721         Discard the files before the named <file> from the output
722         (i.e. 'skip to'), or move them to the end of the output
723         (i.e. 'rotate to').  These were invented primarily for use
724         of the `git difftool` command, and may not be very useful
725         otherwise.
727 ifndef::git-format-patch[]
728 -R::
729         Swap two inputs; that is, show differences from index or
730         on-disk file to tree contents.
731 endif::git-format-patch[]
733 --relative[=<path>]::
734 --no-relative::
735         When run from a subdirectory of the project, it can be
736         told to exclude changes outside the directory and show
737         pathnames relative to it with this option.  When you are
738         not in a subdirectory (e.g. in a bare repository), you
739         can name which subdirectory to make the output relative
740         to by giving a <path> as an argument.
741         `--no-relative` can be used to countermand both `diff.relative` config
742         option and previous `--relative`.
744 -a::
745 --text::
746         Treat all files as text.
748 --ignore-cr-at-eol::
749         Ignore carriage-return at the end of line when doing a comparison.
751 --ignore-space-at-eol::
752         Ignore changes in whitespace at EOL.
754 -b::
755 --ignore-space-change::
756         Ignore changes in amount of whitespace.  This ignores whitespace
757         at line end, and considers all other sequences of one or
758         more whitespace characters to be equivalent.
760 -w::
761 --ignore-all-space::
762         Ignore whitespace when comparing lines.  This ignores
763         differences even if one line has whitespace where the other
764         line has none.
766 --ignore-blank-lines::
767         Ignore changes whose lines are all blank.
769 -I<regex>::
770 --ignore-matching-lines=<regex>::
771         Ignore changes whose all lines match <regex>.  This option may
772         be specified more than once.
774 --inter-hunk-context=<lines>::
775         Show the context between diff hunks, up to the specified number
776         of lines, thereby fusing hunks that are close to each other.
777         Defaults to `diff.interHunkContext` or 0 if the config option
778         is unset.
780 -W::
781 --function-context::
782         Show whole function as context lines for each change.
783         The function names are determined in the same way as
784         `git diff` works out patch hunk headers (see 'Defining a
785         custom hunk-header' in linkgit:gitattributes[5]).
787 ifndef::git-format-patch[]
788 ifndef::git-log[]
789 --exit-code::
790         Make the program exit with codes similar to diff(1).
791         That is, it exits with 1 if there were differences and
792         0 means no differences.
794 --quiet::
795         Disable all output of the program. Implies `--exit-code`.
796 endif::git-log[]
797 endif::git-format-patch[]
799 --ext-diff::
800         Allow an external diff helper to be executed. If you set an
801         external diff driver with linkgit:gitattributes[5], you need
802         to use this option with linkgit:git-log[1] and friends.
804 --no-ext-diff::
805         Disallow external diff drivers.
807 --textconv::
808 --no-textconv::
809         Allow (or disallow) external text conversion filters to be run
810         when comparing binary files. See linkgit:gitattributes[5] for
811         details. Because textconv filters are typically a one-way
812         conversion, the resulting diff is suitable for human
813         consumption, but cannot be applied. For this reason, textconv
814         filters are enabled by default only for linkgit:git-diff[1] and
815         linkgit:git-log[1], but not for linkgit:git-format-patch[1] or
816         diff plumbing commands.
818 --ignore-submodules[=<when>]::
819         Ignore changes to submodules in the diff generation. <when> can be
820         either "none", "untracked", "dirty" or "all", which is the default.
821         Using "none" will consider the submodule modified when it either contains
822         untracked or modified files or its HEAD differs from the commit recorded
823         in the superproject and can be used to override any settings of the
824         'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
825         "untracked" is used submodules are not considered dirty when they only
826         contain untracked content (but they are still scanned for modified
827         content). Using "dirty" ignores all changes to the work tree of submodules,
828         only changes to the commits stored in the superproject are shown (this was
829         the behavior until 1.7.0). Using "all" hides all changes to submodules.
831 --src-prefix=<prefix>::
832         Show the given source prefix instead of "a/".
834 --dst-prefix=<prefix>::
835         Show the given destination prefix instead of "b/".
837 --no-prefix::
838         Do not show any source or destination prefix.
840 --line-prefix=<prefix>::
841         Prepend an additional prefix to every line of output.
843 --ita-invisible-in-index::
844         By default entries added by "git add -N" appear as an existing
845         empty file in "git diff" and a new file in "git diff --cached".
846         This option makes the entry appear as a new file in "git diff"
847         and non-existent in "git diff --cached". This option could be
848         reverted with `--ita-visible-in-index`. Both options are
849         experimental and could be removed in future.
851 For more detailed explanation on these common options, see also
852 linkgit:gitdiffcore[7].