1GIT-DIFF(1)                       Git Manual                       GIT-DIFF(1)
2
3
4

NAME

6       git-diff - Show changes between commits, commit and working tree, etc
7

SYNOPSIS

9       git diff [<options>] [<commit>] [--] [<path>...]
10       git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]
11       git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
12       git diff [<options>] <commit>...<commit> [--] [<path>...]
13       git diff [<options>] <blob> <blob>
14       git diff [<options>] --no-index [--] <path> <path>
15

DESCRIPTION

17       Show changes between the working tree and the index or a tree, changes
18       between the index and a tree, changes between two trees, changes
19       resulting from a merge, changes between two blob objects, or changes
20       between two files on disk.
21
22       git diff [<options>] [--] [<path>...]
23           This form is to view the changes you made relative to the index
24           (staging area for the next commit). In other words, the differences
25           are what you could tell Git to further add to the index but you
26           still haven’t. You can stage these changes by using git-add(1).
27
28       git diff [<options>] --no-index [--] <path> <path>
29           This form is to compare the given two paths on the filesystem. You
30           can omit the --no-index option when running the command in a
31           working tree controlled by Git and at least one of the paths points
32           outside the working tree, or when running the command outside a
33           working tree controlled by Git. This form implies --exit-code.
34
35       git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...
36       ]
37           This form is to view the changes you staged for the next commit
38           relative to the named <commit>. Typically you would want comparison
39           with the latest commit, so if you do not give <commit>, it defaults
40           to HEAD. If HEAD does not exist (e.g. unborn branches) and <commit>
41           is not given, it shows all staged changes. --staged is a synonym of
42           --cached.
43
44           If --merge-base is given, instead of using <commit>, use the merge
45           base of <commit> and HEAD.  git diff --cached --merge-base A is
46           equivalent to git diff --cached $(git merge-base A HEAD).
47
48       git diff [<options>] [--merge-base] <commit> [--] [<path>...]
49           This form is to view the changes you have in your working tree
50           relative to the named <commit>. You can use HEAD to compare it with
51           the latest commit, or a branch name to compare with the tip of a
52           different branch.
53
54           If --merge-base is given, instead of using <commit>, use the merge
55           base of <commit> and HEAD.  git diff --merge-base A is equivalent
56           to git diff $(git merge-base A HEAD).
57
58       git diff [<options>] [--merge-base] <commit> <commit> [--] [<path>...]
59           This is to view the changes between two arbitrary <commit>.
60
61           If --merge-base is given, use the merge base of the two commits for
62           the "before" side.  git diff --merge-base A B is equivalent to git
63           diff $(git merge-base A B) B.
64
65       git diff [<options>] <commit> <commit>... <commit> [--] [<path>...]
66           This form is to view the results of a merge commit. The first
67           listed <commit> must be the merge itself; the remaining two or more
68           commits should be its parents. Convenient ways to produce the
69           desired set of revisions are to use the suffixes ^@ and ^!. If A is
70           a merge commit, then git diff A A^@, git diff A^!  and git show A
71           all give the same combined diff.
72
73       git diff [<options>] <commit>..<commit> [--] [<path>...]
74           This is synonymous to the earlier form (without the ..) for viewing
75           the changes between two arbitrary <commit>. If <commit> on one side
76           is omitted, it will have the same effect as using HEAD instead.
77
78       git diff [<options>] <commit>...<commit> [--] [<path>...]
79           This form is to view the changes on the branch containing and up to
80           the second <commit>, starting at a common ancestor of both
81           <commit>.  git diff A...B is equivalent to git diff $(git
82           merge-base A B) B. You can omit any one of <commit>, which has the
83           same effect as using HEAD instead.
84
85       Just in case you are doing something exotic, it should be noted that
86       all of the <commit> in the above description, except in the
87       --merge-base case and in the last two forms that use .. notations, can
88       be any <tree>.
89
90       For a more complete list of ways to spell <commit>, see "SPECIFYING
91       REVISIONS" section in gitrevisions(7). However, "diff" is about
92       comparing two endpoints, not ranges, and the range notations
93       (<commit>..<commit> and <commit>...<commit>) do not mean a range as
94       defined in the "SPECIFYING RANGES" section in gitrevisions(7).
95
96       git diff [<options>] <blob> <blob>
97           This form is to view the differences between the raw contents of
98           two blob objects.
99

OPTIONS

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

RAW OUTPUT FORMAT

789       The raw output format from "git-diff-index", "git-diff-tree",
790       "git-diff-files" and "git diff --raw" are very similar.
791
792       These commands all compare two sets of things; what is compared
793       differs:
794
795       git-diff-index <tree-ish>
796           compares the <tree-ish> and the files on the filesystem.
797
798       git-diff-index --cached <tree-ish>
799           compares the <tree-ish> and the index.
800
801       git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
802           compares the trees named by the two arguments.
803
804       git-diff-files [<pattern>...]
805           compares the index and the files on the filesystem.
806
807       The "git-diff-tree" command begins its output by printing the hash of
808       what is being compared. After that, all the commands print one output
809       line per changed file.
810
811       An output line is formatted this way:
812
813           in-place edit  :100644 100644 bcd1234 0123456 M file0
814           copy-edit      :100644 100644 abcd123 1234567 C68 file1 file2
815           rename-edit    :100644 100644 abcd123 1234567 R86 file1 file3
816           create         :000000 100644 0000000 1234567 A file4
817           delete         :100644 000000 1234567 0000000 D file5
818           unmerged       :000000 000000 0000000 0000000 U file6
819
820       That is, from the left to the right:
821
822        1. a colon.
823
824        2. mode for "src"; 000000 if creation or unmerged.
825
826        3. a space.
827
828        4. mode for "dst"; 000000 if deletion or unmerged.
829
830        5. a space.
831
832        6. sha1 for "src"; 0{40} if creation or unmerged.
833
834        7. a space.
835
836        8. sha1 for "dst"; 0{40} if deletion, unmerged or "work tree out of
837           sync with the index".
838
839        9. a space.
840
841       10. status, followed by optional "score" number.
842
843       11. a tab or a NUL when -z option is used.
844
845       12. path for "src"
846
847       13. a tab or a NUL when -z option is used; only exists for C or R.
848
849       14. path for "dst"; only exists for C or R.
850
851       15. an LF or a NUL when -z option is used, to terminate the record.
852
853       Possible status letters are:
854
855       •   A: addition of a file
856
857       •   C: copy of a file into a new one
858
859       •   D: deletion of a file
860
861       •   M: modification of the contents or mode of a file
862
863       •   R: renaming of a file
864
865       •   T: change in the type of the file (regular file, symbolic link or
866           submodule)
867
868       •   U: file is unmerged (you must complete the merge before it can be
869           committed)
870
871       •   X: "unknown" change type (most probably a bug, please report it)
872
873       Status letters C and R are always followed by a score (denoting the
874       percentage of similarity between the source and target of the move or
875       copy). Status letter M may be followed by a score (denoting the
876       percentage of dissimilarity) for file rewrites.
877
878       The sha1 for "dst" is shown as all 0’s if a file on the filesystem is
879       out of sync with the index.
880
881       Example:
882
883           :100644 100644 5be4a4a 0000000 M file.c
884
885       Without the -z option, pathnames with "unusual" characters are quoted
886       as explained for the configuration variable core.quotePath (see git-
887       config(1)). Using -z the filename is output verbatim and the line is
888       terminated by a NUL byte.
889

DIFF FORMAT FOR MERGES

891       "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
892       --cc option to generate diff output also for merge commits. The output
893       differs from the format described above in the following way:
894
895        1. there is a colon for each parent
896
897        2. there are more "src" modes and "src" sha1
898
899        3. status is concatenated status characters for each parent
900
901        4. no optional "score" number
902
903        5. tab-separated pathname(s) of the file
904
905       For -c and --cc, only the destination or final path is shown even if
906       the file was renamed on any side of history. With --combined-all-paths,
907       the name of the path in each parent is shown followed by the name of
908       the path in the merge commit.
909
910       Examples for -c and --cc without --combined-all-paths:
911
912           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       desc.c
913           ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM       bar.sh
914           ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR       phooey.c
915
916       Examples when --combined-all-paths added to either -c or --cc:
917
918           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       desc.c  desc.c  desc.c
919           ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM       foo.sh  bar.sh  bar.sh
920           ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR       fooey.c fuey.c  phooey.c
921
922       Note that combined diff lists only files which were modified from all
923       parents.
924

GENERATING PATCH TEXT WITH -P

926       Running git-diff(1), git-log(1), git-show(1), git-diff-index(1), git-
927       diff-tree(1), or git-diff-files(1) with the -p option produces patch
928       text. You can customize the creation of patch text via the
929       GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables (see
930       git(1)), and the diff attribute (see gitattributes(5)).
931
932       What the -p option produces is slightly different from the traditional
933       diff format:
934
935        1. It is preceded with a "git diff" header that looks like this:
936
937               diff --git a/file1 b/file2
938
939           The a/ and b/ filenames are the same unless rename/copy is
940           involved. Especially, even for a creation or a deletion, /dev/null
941           is not used in place of the a/ or b/ filenames.
942
943           When rename/copy is involved, file1 and file2 show the name of the
944           source file of the rename/copy and the name of the file that
945           rename/copy produces, respectively.
946
947        2. It is followed by one or more extended header lines:
948
949               old mode <mode>
950               new mode <mode>
951               deleted file mode <mode>
952               new file mode <mode>
953               copy from <path>
954               copy to <path>
955               rename from <path>
956               rename to <path>
957               similarity index <number>
958               dissimilarity index <number>
959               index <hash>..<hash> <mode>
960
961           File modes are printed as 6-digit octal numbers including the file
962           type and file permission bits.
963
964           Path names in extended headers do not include the a/ and b/
965           prefixes.
966
967           The similarity index is the percentage of unchanged lines, and the
968           dissimilarity index is the percentage of changed lines. It is a
969           rounded down integer, followed by a percent sign. The similarity
970           index value of 100% is thus reserved for two equal files, while
971           100% dissimilarity means that no line from the old file made it
972           into the new one.
973
974           The index line includes the blob object names before and after the
975           change. The <mode> is included if the file mode does not change;
976           otherwise, separate lines indicate the old and the new mode.
977
978        3. Pathnames with "unusual" characters are quoted as explained for the
979           configuration variable core.quotePath (see git-config(1)).
980
981        4. All the file1 files in the output refer to files before the commit,
982           and all the file2 files refer to files after the commit. It is
983           incorrect to apply each change to each file sequentially. For
984           example, this patch will swap a and b:
985
986               diff --git a/a b/b
987               rename from a
988               rename to b
989               diff --git a/b b/a
990               rename from b
991               rename to a
992
993        5. Hunk headers mention the name of the function to which the hunk
994           applies. See "Defining a custom hunk-header" in gitattributes(5)
995           for details of how to tailor to this to specific languages.
996

COMBINED DIFF FORMAT

998       Any diff-generating command can take the -c or --cc option to produce a
999       combined diff when showing a merge. This is the default format when
1000       showing merges with git-diff(1) or git-show(1). Note also that you can
1001       give suitable --diff-merges option to any of these commands to force
1002       generation of diffs in specific format.
1003
1004       A "combined diff" format looks like this:
1005
1006           diff --combined describe.c
1007           index fabadb8,cc95eb0..4866510
1008           --- a/describe.c
1009           +++ b/describe.c
1010           @@@ -98,20 -98,12 +98,20 @@@
1011                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1012             }
1013
1014           - static void describe(char *arg)
1015            -static void describe(struct commit *cmit, int last_one)
1016           ++static void describe(char *arg, int last_one)
1017             {
1018            +      unsigned char sha1[20];
1019            +      struct commit *cmit;
1020                   struct commit_list *list;
1021                   static int initialized = 0;
1022                   struct commit_name *n;
1023
1024            +      if (get_sha1(arg, sha1) < 0)
1025            +              usage(describe_usage);
1026            +      cmit = lookup_commit_reference(sha1);
1027            +      if (!cmit)
1028            +              usage(describe_usage);
1029            +
1030                   if (!initialized) {
1031                           initialized = 1;
1032                           for_each_ref(get_name);
1033
1034        1. It is preceded with a "git diff" header, that looks like this (when
1035           the -c option is used):
1036
1037               diff --combined file
1038
1039           or like this (when the --cc option is used):
1040
1041               diff --cc file
1042
1043        2. It is followed by one or more extended header lines (this example
1044           shows a merge with two parents):
1045
1046               index <hash>,<hash>..<hash>
1047               mode <mode>,<mode>..<mode>
1048               new file mode <mode>
1049               deleted file mode <mode>,<mode>
1050
1051           The mode <mode>,<mode>..<mode> line appears only if at least one of
1052           the <mode> is different from the rest. Extended headers with
1053           information about detected contents movement (renames and copying
1054           detection) are designed to work with diff of two <tree-ish> and are
1055           not used by combined diff format.
1056
1057        3. It is followed by two-line from-file/to-file header
1058
1059               --- a/file
1060               +++ b/file
1061
1062           Similar to two-line header for traditional unified diff format,
1063           /dev/null is used to signal created or deleted files.
1064
1065           However, if the --combined-all-paths option is provided, instead of
1066           a two-line from-file/to-file you get a N+1 line from-file/to-file
1067           header, where N is the number of parents in the merge commit
1068
1069               --- a/file
1070               --- a/file
1071               --- a/file
1072               +++ b/file
1073
1074           This extended format can be useful if rename or copy detection is
1075           active, to allow you to see the original name of the file in
1076           different parents.
1077
1078        4. Chunk header format is modified to prevent people from accidentally
1079           feeding it to patch -p1. Combined diff format was created for
1080           review of merge commit changes, and was not meant to be applied.
1081           The change is similar to the change in the extended index header:
1082
1083               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1084
1085           There are (number of parents + 1) @ characters in the chunk header
1086           for combined diff format.
1087
1088       Unlike the traditional unified diff format, which shows two files A and
1089       B with a single column that has - (minus — appears in A but removed in
1090       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1091       prefix, this format compares two or more files file1, file2,... with
1092       one file X, and shows how X differs from each of fileN. One column for
1093       each of fileN is prepended to the output line to note how X’s line is
1094       different from it.
1095
1096       A - character in the column N means that the line appears in fileN but
1097       it does not appear in the result. A + character in the column N means
1098       that the line appears in the result, and fileN does not have that line
1099       (in other words, the line was added, from the point of view of that
1100       parent).
1101
1102       In the above example output, the function signature was changed from
1103       both files (hence two - removals from both file1 and file2, plus ++ to
1104       mean one line that was added does not appear in either file1 or file2).
1105       Also eight other lines are the same from file1 but do not appear in
1106       file2 (hence prefixed with +).
1107
1108       When shown by git diff-tree -c, it compares the parents of a merge
1109       commit with the merge result (i.e. file1..fileN are the parents). When
1110       shown by git diff-files -c, it compares the two unresolved merge
1111       parents with the working tree file (i.e. file1 is stage 2 aka "our
1112       version", file2 is stage 3 aka "their version").
1113

OTHER DIFF FORMATS

1115       The --summary option describes newly added, deleted, renamed and copied
1116       files. The --stat option adds diffstat(1) graph to the output. These
1117       options can be combined with other options, such as -p, and are meant
1118       for human consumption.
1119
1120       When showing a change that involves a rename or a copy, --stat output
1121       formats the pathnames compactly by combining common prefix and suffix
1122       of the pathnames. For example, a change that moves arch/i386/Makefile
1123       to arch/x86/Makefile while modifying 4 lines will be shown like this:
1124
1125           arch/{i386 => x86}/Makefile    |   4 +--
1126
1127       The --numstat option gives the diffstat(1) information but is designed
1128       for easier machine consumption. An entry in --numstat output looks like
1129       this:
1130
1131           1       2       README
1132           3       1       arch/{i386 => x86}/Makefile
1133
1134       That is, from left to right:
1135
1136        1. the number of added lines;
1137
1138        2. a tab;
1139
1140        3. the number of deleted lines;
1141
1142        4. a tab;
1143
1144        5. pathname (possibly with rename/copy information);
1145
1146        6. a newline.
1147
1148       When -z output option is in effect, the output is formatted this way:
1149
1150           1       2       README NUL
1151           3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
1152
1153       That is:
1154
1155        1. the number of added lines;
1156
1157        2. a tab;
1158
1159        3. the number of deleted lines;
1160
1161        4. a tab;
1162
1163        5. a NUL (only exists if renamed/copied);
1164
1165        6. pathname in preimage;
1166
1167        7. a NUL (only exists if renamed/copied);
1168
1169        8. pathname in postimage (only exists if renamed/copied);
1170
1171        9. a NUL.
1172
1173       The extra NUL before the preimage path in renamed case is to allow
1174       scripts that read the output to tell if the current record being read
1175       is a single-path record or a rename/copy record without reading ahead.
1176       After reading added and deleted lines, reading up to NUL would yield
1177       the pathname, but if that is NUL, the record will show two paths.
1178

EXAMPLES

1180       Various ways to check your working tree
1181
1182               $ git diff            (1)
1183               $ git diff --cached   (2)
1184               $ git diff HEAD       (3)
1185
1186            1. Changes in the working tree not yet staged for the next
1187               commit.
1188
1189            2. Changes between the index and your last commit; what you
1190               would be committing if you run git commit without -a
1191               option.
1192            3. Changes in the working tree since your last commit; what
1193               you would be committing if you run git commit -a
1194
1195       Comparing with arbitrary commits
1196
1197               $ git diff test            (1)
1198               $ git diff HEAD -- ./test  (2)
1199               $ git diff HEAD^ HEAD      (3)
1200
1201            1. Instead of using the tip of the current branch, compare
1202               with the tip of "test" branch.
1203            2. Instead of comparing with the tip of "test" branch,
1204               compare with the tip of the current branch, but limit the
1205               comparison to the file "test".
1206            3. Compare the version before the last commit and the last
1207               commit.
1208
1209       Comparing branches
1210
1211               $ git diff topic master    (1)
1212               $ git diff topic..master   (2)
1213               $ git diff topic...master  (3)
1214
1215            1. Changes between the tips of the topic and the master
1216               branches.
1217            2. Same as above.
1218            3. Changes that occurred on the master branch since when the
1219               topic branch was started off it.
1220
1221       Limiting the diff output
1222
1223               $ git diff --diff-filter=MRC            (1)
1224               $ git diff --name-status                (2)
1225               $ git diff arch/i386 include/asm-i386   (3)
1226
1227            1. Show only modification, rename, and copy, but not addition
1228               or deletion.
1229            2. Show only names and the nature of change, but not actual
1230               diff output.
1231            3. Limit diff output to named subtrees.
1232
1233       Munging the diff output
1234
1235               $ git diff --find-copies-harder -B -C  (1)
1236               $ git diff -R                          (2)
1237
1238            1. Spend extra cycles to find renames, copies and complete
1239               rewrites (very expensive).
1240            2. Output diff in reverse.
1241

CONFIGURATION

1243       Everything below this line in this section is selectively included from
1244       the git-config(1) documentation. The content is the same as what’s
1245       found there:
1246
1247       diff.autoRefreshIndex
1248           When using git diff to compare with work tree files, do not
1249           consider stat-only change as changed. Instead, silently run git
1250           update-index --refresh to update the cached stat information for
1251           paths whose contents in the work tree match the contents in the
1252           index. This option defaults to true. Note that this affects only
1253           git diff Porcelain, and not lower level diff commands such as git
1254           diff-files.
1255
1256       diff.dirstat
1257           A comma separated list of --dirstat parameters specifying the
1258           default behavior of the --dirstat option to git-diff(1) and
1259           friends. The defaults can be overridden on the command line (using
1260           --dirstat=<param1,param2,...>). The fallback defaults (when not
1261           changed by diff.dirstat) are changes,noncumulative,3. The following
1262           parameters are available:
1263
1264           changes
1265               Compute the dirstat numbers by counting the lines that have
1266               been removed from the source, or added to the destination. This
1267               ignores the amount of pure code movements within a file. In
1268               other words, rearranging lines in a file is not counted as much
1269               as other changes. This is the default behavior when no
1270               parameter is given.
1271
1272           lines
1273               Compute the dirstat numbers by doing the regular line-based
1274               diff analysis, and summing the removed/added line counts. (For
1275               binary files, count 64-byte chunks instead, since binary files
1276               have no natural concept of lines). This is a more expensive
1277               --dirstat behavior than the changes behavior, but it does count
1278               rearranged lines within a file as much as other changes. The
1279               resulting output is consistent with what you get from the other
1280               --*stat options.
1281
1282           files
1283               Compute the dirstat numbers by counting the number of files
1284               changed. Each changed file counts equally in the dirstat
1285               analysis. This is the computationally cheapest --dirstat
1286               behavior, since it does not have to look at the file contents
1287               at all.
1288
1289           cumulative
1290               Count changes in a child directory for the parent directory as
1291               well. Note that when using cumulative, the sum of the
1292               percentages reported may exceed 100%. The default
1293               (non-cumulative) behavior can be specified with the
1294               noncumulative parameter.
1295
1296           <limit>
1297               An integer parameter specifies a cut-off percent (3% by
1298               default). Directories contributing less than this percentage of
1299               the changes are not shown in the output.
1300
1301           Example: The following will count changed files, while ignoring
1302           directories with less than 10% of the total amount of changed
1303           files, and accumulating child directory counts in the parent
1304           directories: files,10,cumulative.
1305
1306       diff.statGraphWidth
1307           Limit the width of the graph part in --stat output. If set, applies
1308           to all commands generating --stat output except format-patch.
1309
1310       diff.context
1311           Generate diffs with <n> lines of context instead of the default of
1312           3. This value is overridden by the -U option.
1313
1314       diff.interHunkContext
1315           Show the context between diff hunks, up to the specified number of
1316           lines, thereby fusing the hunks that are close to each other. This
1317           value serves as the default for the --inter-hunk-context command
1318           line option.
1319
1320       diff.external
1321           If this config variable is set, diff generation is not performed
1322           using the internal diff machinery, but using the given command. Can
1323           be overridden with the “GIT_EXTERNAL_DIFF” environment variable.
1324           The command is called with parameters as described under "git
1325           Diffs" in git(1). Note: if you want to use an external diff program
1326           only on a subset of your files, you might want to use
1327           gitattributes(5) instead.
1328
1329       diff.ignoreSubmodules
1330           Sets the default value of --ignore-submodules. Note that this
1331           affects only git diff Porcelain, and not lower level diff commands
1332           such as git diff-files.  git checkout and git switch also honor
1333           this setting when reporting uncommitted changes. Setting it to all
1334           disables the submodule summary normally shown by git commit and git
1335           status when status.submoduleSummary is set unless it is overridden
1336           by using the --ignore-submodules command-line option. The git
1337           submodule commands are not affected by this setting. By default
1338           this is set to untracked so that any untracked submodules are
1339           ignored.
1340
1341       diff.mnemonicPrefix
1342           If set, git diff uses a prefix pair that is different from the
1343           standard "a/" and "b/" depending on what is being compared. When
1344           this configuration is in effect, reverse diff output also swaps the
1345           order of the prefixes:
1346
1347           git diff
1348               compares the (i)ndex and the (w)ork tree;
1349
1350           git diff HEAD
1351               compares a (c)ommit and the (w)ork tree;
1352
1353           git diff --cached
1354               compares a (c)ommit and the (i)ndex;
1355
1356           git diff HEAD:file1 file2
1357               compares an (o)bject and a (w)ork tree entity;
1358
1359           git diff --no-index a b
1360               compares two non-git things (1) and (2).
1361
1362       diff.noprefix
1363           If set, git diff does not show any source or destination prefix.
1364
1365       diff.relative
1366           If set to true, git diff does not show changes outside of the
1367           directory and show pathnames relative to the current directory.
1368
1369       diff.orderFile
1370           File indicating how to order files within a diff. See the -O option
1371           to git-diff(1) for details. If diff.orderFile is a relative
1372           pathname, it is treated as relative to the top of the working tree.
1373
1374       diff.renameLimit
1375           The number of files to consider in the exhaustive portion of
1376           copy/rename detection; equivalent to the git diff option -l. If not
1377           set, the default value is currently 1000. This setting has no
1378           effect if rename detection is turned off.
1379
1380       diff.renames
1381           Whether and how Git detects renames. If set to "false", rename
1382           detection is disabled. If set to "true", basic rename detection is
1383           enabled. If set to "copies" or "copy", Git will detect copies, as
1384           well. Defaults to true. Note that this affects only git diff
1385           Porcelain like git-diff(1) and git-log(1), and not lower level
1386           commands such as git-diff-files(1).
1387
1388       diff.suppressBlankEmpty
1389           A boolean to inhibit the standard behavior of printing a space
1390           before each empty output line. Defaults to false.
1391
1392       diff.submodule
1393           Specify the format in which differences in submodules are shown.
1394           The "short" format just shows the names of the commits at the
1395           beginning and end of the range. The "log" format lists the commits
1396           in the range like git-submodule(1) summary does. The "diff" format
1397           shows an inline diff of the changed contents of the submodule.
1398           Defaults to "short".
1399
1400       diff.wordRegex
1401           A POSIX Extended Regular Expression used to determine what is a
1402           "word" when performing word-by-word difference calculations.
1403           Character sequences that match the regular expression are "words",
1404           all other characters are ignorable whitespace.
1405
1406       diff.<driver>.command
1407           The custom diff driver command. See gitattributes(5) for details.
1408
1409       diff.<driver>.xfuncname
1410           The regular expression that the diff driver should use to recognize
1411           the hunk header. A built-in pattern may also be used. See
1412           gitattributes(5) for details.
1413
1414       diff.<driver>.binary
1415           Set this option to true to make the diff driver treat files as
1416           binary. See gitattributes(5) for details.
1417
1418       diff.<driver>.textconv
1419           The command that the diff driver should call to generate the
1420           text-converted version of a file. The result of the conversion is
1421           used to generate a human-readable diff. See gitattributes(5) for
1422           details.
1423
1424       diff.<driver>.wordRegex
1425           The regular expression that the diff driver should use to split
1426           words in a line. See gitattributes(5) for details.
1427
1428       diff.<driver>.cachetextconv
1429           Set this option to true to make the diff driver cache the text
1430           conversion outputs. See gitattributes(5) for details.
1431
1432           araxis
1433               Use Araxis Merge (requires a graphical session)
1434
1435           bc
1436               Use Beyond Compare (requires a graphical session)
1437
1438           bc3
1439               Use Beyond Compare (requires a graphical session)
1440
1441           bc4
1442               Use Beyond Compare (requires a graphical session)
1443
1444           codecompare
1445               Use Code Compare (requires a graphical session)
1446
1447           deltawalker
1448               Use DeltaWalker (requires a graphical session)
1449
1450           diffmerge
1451               Use DiffMerge (requires a graphical session)
1452
1453           diffuse
1454               Use Diffuse (requires a graphical session)
1455
1456           ecmerge
1457               Use ECMerge (requires a graphical session)
1458
1459           emerge
1460               Use Emacs' Emerge
1461
1462           examdiff
1463               Use ExamDiff Pro (requires a graphical session)
1464
1465           guiffy
1466               Use Guiffy’s Diff Tool (requires a graphical session)
1467
1468           gvimdiff
1469               Use gVim (requires a graphical session)
1470
1471           kdiff3
1472               Use KDiff3 (requires a graphical session)
1473
1474           kompare
1475               Use Kompare (requires a graphical session)
1476
1477           meld
1478               Use Meld (requires a graphical session)
1479
1480           nvimdiff
1481               Use Neovim
1482
1483           opendiff
1484               Use FileMerge (requires a graphical session)
1485
1486           p4merge
1487               Use HelixCore P4Merge (requires a graphical session)
1488
1489           smerge
1490               Use Sublime Merge (requires a graphical session)
1491
1492           tkdiff
1493               Use TkDiff (requires a graphical session)
1494
1495           vimdiff
1496               Use Vim
1497
1498           winmerge
1499               Use WinMerge (requires a graphical session)
1500
1501           xxdiff
1502               Use xxdiff (requires a graphical session)
1503
1504       diff.indentHeuristic
1505           Set this option to false to disable the default heuristics that
1506           shift diff hunk boundaries to make patches easier to read.
1507
1508       diff.algorithm
1509           Choose a diff algorithm. The variants are as follows:
1510
1511           default, myers
1512               The basic greedy diff algorithm. Currently, this is the
1513               default.
1514
1515           minimal
1516               Spend extra time to make sure the smallest possible diff is
1517               produced.
1518
1519           patience
1520               Use "patience diff" algorithm when generating patches.
1521
1522           histogram
1523               This algorithm extends the patience algorithm to "support
1524               low-occurrence common elements".
1525
1526       diff.wsErrorHighlight
1527           Highlight whitespace errors in the context, old or new lines of the
1528           diff. Multiple values are separated by comma, none resets previous
1529           values, default reset the list to new and all is a shorthand for
1530           old,new,context. The whitespace errors are colored with
1531           color.diff.whitespace. The command line option
1532           --ws-error-highlight=<kind> overrides this setting.
1533
1534       diff.colorMoved
1535           If set to either a valid <mode> or a true value, moved lines in a
1536           diff are colored differently, for details of valid modes see
1537           --color-moved in git-diff(1). If simply set to true the default
1538           color mode will be used. When set to false, moved lines are not
1539           colored.
1540
1541       diff.colorMovedWS
1542           When moved lines are colored using e.g. the diff.colorMoved
1543           setting, this option controls the <mode> how spaces are treated for
1544           details of valid modes see --color-moved-ws in git-diff(1).
1545

SEE ALSO

1547       diff(1), git-difftool(1), git-log(1), gitdiffcore(7), git-format-
1548       patch(1), git-apply(1), git-show(1)
1549

GIT

1551       Part of the git(1) suite
1552
1553
1554
1555Git 2.39.1                        2023-01-13                       GIT-DIFF(1)
Impressum