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