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>. A tree of interest is the one pointed to by the special
89       ref AUTO_MERGE, which is written by the ort merge strategy upon hitting
90       merge conflicts (see git-merge(1)). Comparing the working tree with
91       AUTO_MERGE shows changes you’ve made so far to resolve textual
92       conflicts (see the examples below).
93
94       For a more complete list of ways to spell <commit>, see "SPECIFYING
95       REVISIONS" section in gitrevisions(7). However, "diff" is about
96       comparing two endpoints, not ranges, and the range notations
97       (<commit>..<commit> and <commit>...<commit>) do not mean a range as
98       defined in the "SPECIFYING RANGES" section in gitrevisions(7).
99
100       git diff [<options>] <blob> <blob>
101           This form is to view the differences between the raw contents of
102           two blob objects.
103

OPTIONS

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

RAW OUTPUT FORMAT

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

DIFF FORMAT FOR MERGES

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

GENERATING PATCH TEXT WITH -P

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

COMBINED DIFF FORMAT

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

OTHER DIFF FORMATS

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

EXAMPLES

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

CONFIGURATION

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

SEE ALSO

1569       diff(1), git-difftool(1), git-log(1), gitdiffcore(7), git-format-
1570       patch(1), git-apply(1), git-show(1)
1571

GIT

1573       Part of the git(1) suite
1574
1575
1576
1577Git 2.43.0                        11/20/2023                       GIT-DIFF(1)
Impressum