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

NAME

6       git-diff-tree - Compares the content and mode of blobs found via two
7       tree objects
8

SYNOPSIS

10       git diff-tree [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
11                     [-t] [-r] [-c | --cc] [--combined-all-paths] [--root]
12                     [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]
13
14

DESCRIPTION

16       Compares the content and mode of the blobs found via two tree objects.
17
18       If there is only one <tree-ish> given, the commit is compared with its
19       parents (see --stdin below).
20
21       Note that git diff-tree can use the tree encapsulated in a commit
22       object.
23

OPTIONS

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

PRETTY FORMATS

836       If the commit is a merge, and if the pretty-format is not oneline,
837       email or raw, an additional line is inserted before the Author: line.
838       This line begins with "Merge: " and the sha1s of ancestral commits are
839       printed, separated by spaces. Note that the listed commits may not
840       necessarily be the list of the direct parent commits if you have
841       limited your view of history: for example, if you are only interested
842       in changes related to a certain directory or file.
843
844       There are several built-in formats, and you can define additional
845       formats by setting a pretty.<name> config option to either another
846       format name, or a format: string, as described below (see git-
847       config(1)). Here are the details of the built-in formats:
848
849       ·   oneline
850
851               <sha1> <title line>
852
853           This is designed to be as compact as possible.
854
855       ·   short
856
857               commit <sha1>
858               Author: <author>
859
860               <title line>
861
862       ·   medium
863
864               commit <sha1>
865               Author: <author>
866               Date:   <author date>
867
868               <title line>
869
870               <full commit message>
871
872       ·   full
873
874               commit <sha1>
875               Author: <author>
876               Commit: <committer>
877
878               <title line>
879
880               <full commit message>
881
882       ·   fuller
883
884               commit <sha1>
885               Author:     <author>
886               AuthorDate: <author date>
887               Commit:     <committer>
888               CommitDate: <committer date>
889
890               <title line>
891
892               <full commit message>
893
894       ·   email
895
896               From <sha1> <date>
897               From: <author>
898               Date: <author date>
899               Subject: [PATCH] <title line>
900
901               <full commit message>
902
903       ·   raw
904
905           The raw format shows the entire commit exactly as stored in the
906           commit object. Notably, the SHA-1s are displayed in full,
907           regardless of whether --abbrev or --no-abbrev are used, and parents
908           information show the true parent commits, without taking grafts or
909           history simplification into account. Note that this format affects
910           the way commits are displayed, but not the way the diff is shown
911           e.g. with git log --raw. To get full object names in a raw diff
912           format, use --no-abbrev.
913
914       ·   format:<string>
915
916           The format:<string> format allows you to specify which information
917           you want to show. It works a little bit like printf format, with
918           the notable exception that you get a newline with %n instead of \n.
919
920           E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
921           would show something like this:
922
923               The author of fe6e0ee was Junio C Hamano, 23 hours ago
924               The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
925
926           The placeholders are:
927
928           ·   Placeholders that expand to a single literal character:
929
930               %n
931                   newline
932
933               %%
934                   a raw %
935
936               %x00
937                   print a byte from a hex code
938
939           ·   Placeholders that affect formatting of later placeholders:
940
941               %Cred
942                   switch color to red
943
944               %Cgreen
945                   switch color to green
946
947               %Cblue
948                   switch color to blue
949
950               %Creset
951                   reset color
952
953               %C(...)
954                   color specification, as described under Values in the
955                   "CONFIGURATION FILE" section of git-config(1). By default,
956                   colors are shown only when enabled for log output (by
957                   color.diff, color.ui, or --color, and respecting the auto
958                   settings of the former if we are going to a terminal).
959                   %C(auto,...)  is accepted as a historical synonym for the
960                   default (e.g., %C(auto,red)). Specifying %C(always,...)
961                   will show the colors even when color is not otherwise
962                   enabled (though consider just using --color=always to
963                   enable color for the whole output, including this format
964                   and anything else git might color).  auto alone (i.e.
965                   %C(auto)) will turn on auto coloring on the next
966                   placeholders until the color is switched again.
967
968               %m
969                   left (<), right (>) or boundary (-) mark
970
971               %w([<w>[,<i1>[,<i2>]]])
972                   switch line wrapping, like the -w option of git-
973                   shortlog(1).
974
975               %<(<N>[,trunc|ltrunc|mtrunc])
976                   make the next placeholder take at least N columns, padding
977                   spaces on the right if necessary. Optionally truncate at
978                   the beginning (ltrunc), the middle (mtrunc) or the end
979                   (trunc) if the output is longer than N columns. Note that
980                   truncating only works correctly with N >= 2.
981
982               %<|(<N>)
983                   make the next placeholder take at least until Nth columns,
984                   padding spaces on the right if necessary
985
986               %>(<N>), %>|(<N>)
987                   similar to %<(<N>), %<|(<N>) respectively, but padding
988                   spaces on the left
989
990               %>>(<N>), %>>|(<N>)
991                   similar to %>(<N>), %>|(<N>) respectively, except that if
992                   the next placeholder takes more spaces than given and there
993                   are spaces on its left, use those spaces
994
995               %><(<N>), %><|(<N>)
996                   similar to %<(<N>), %<|(<N>) respectively, but padding both
997                   sides (i.e. the text is centered)
998
999           ·   Placeholders that expand to information extracted from the
1000               commit:
1001
1002               %H
1003                   commit hash
1004
1005               %h
1006                   abbreviated commit hash
1007
1008               %T
1009                   tree hash
1010
1011               %t
1012                   abbreviated tree hash
1013
1014               %P
1015                   parent hashes
1016
1017               %p
1018                   abbreviated parent hashes
1019
1020               %an
1021                   author name
1022
1023               %aN
1024                   author name (respecting .mailmap, see git-shortlog(1) or
1025                   git-blame(1))
1026
1027               %ae
1028                   author email
1029
1030               %aE
1031                   author email (respecting .mailmap, see git-shortlog(1) or
1032                   git-blame(1))
1033
1034               %ad
1035                   author date (format respects --date= option)
1036
1037               %aD
1038                   author date, RFC2822 style
1039
1040               %ar
1041                   author date, relative
1042
1043               %at
1044                   author date, UNIX timestamp
1045
1046               %ai
1047                   author date, ISO 8601-like format
1048
1049               %aI
1050                   author date, strict ISO 8601 format
1051
1052               %cn
1053                   committer name
1054
1055               %cN
1056                   committer name (respecting .mailmap, see git-shortlog(1) or
1057                   git-blame(1))
1058
1059               %ce
1060                   committer email
1061
1062               %cE
1063                   committer email (respecting .mailmap, see git-shortlog(1)
1064                   or git-blame(1))
1065
1066               %cd
1067                   committer date (format respects --date= option)
1068
1069               %cD
1070                   committer date, RFC2822 style
1071
1072               %cr
1073                   committer date, relative
1074
1075               %ct
1076                   committer date, UNIX timestamp
1077
1078               %ci
1079                   committer date, ISO 8601-like format
1080
1081               %cI
1082                   committer date, strict ISO 8601 format
1083
1084               %d
1085                   ref names, like the --decorate option of git-log(1)
1086
1087               %D
1088                   ref names without the " (", ")" wrapping.
1089
1090               %S
1091                   ref name given on the command line by which the commit was
1092                   reached (like git log --source), only works with git log
1093
1094               %e
1095                   encoding
1096
1097               %s
1098                   subject
1099
1100               %f
1101                   sanitized subject line, suitable for a filename
1102
1103               %b
1104                   body
1105
1106               %B
1107                   raw body (unwrapped subject and body)
1108
1109               %N
1110                   commit notes
1111
1112               %GG
1113                   raw verification message from GPG for a signed commit
1114
1115               %G?
1116                   show "G" for a good (valid) signature, "B" for a bad
1117                   signature, "U" for a good signature with unknown validity,
1118                   "X" for a good signature that has expired, "Y" for a good
1119                   signature made by an expired key, "R" for a good signature
1120                   made by a revoked key, "E" if the signature cannot be
1121                   checked (e.g. missing key) and "N" for no signature
1122
1123               %GS
1124                   show the name of the signer for a signed commit
1125
1126               %GK
1127                   show the key used to sign a signed commit
1128
1129               %GF
1130                   show the fingerprint of the key used to sign a signed
1131                   commit
1132
1133               %GP
1134                   show the fingerprint of the primary key whose subkey was
1135                   used to sign a signed commit
1136
1137               %gD
1138                   reflog selector, e.g., refs/stash@{1} or refs/stash@{2
1139                   minutes ago}; the format follows the rules described for
1140                   the -g option. The portion before the @ is the refname as
1141                   given on the command line (so git log -g refs/heads/master
1142                   would yield refs/heads/master@{0}).
1143
1144               %gd
1145                   shortened reflog selector; same as %gD, but the refname
1146                   portion is shortened for human readability (so
1147                   refs/heads/master becomes just master).
1148
1149               %gn
1150                   reflog identity name
1151
1152               %gN
1153                   reflog identity name (respecting .mailmap, see git-
1154                   shortlog(1) or git-blame(1))
1155
1156               %ge
1157                   reflog identity email
1158
1159               %gE
1160                   reflog identity email (respecting .mailmap, see git-
1161                   shortlog(1) or git-blame(1))
1162
1163               %gs
1164                   reflog subject
1165
1166               %(trailers[:options])
1167                   display the trailers of the body as interpreted by git-
1168                   interpret-trailers(1). The trailers string may be followed
1169                   by a colon and zero or more comma-separated options:
1170
1171                   ·   key=<K>: only show trailers with specified key.
1172                       Matching is done case-insensitively and trailing colon
1173                       is optional. If option is given multiple times trailer
1174                       lines matching any of the keys are shown. This option
1175                       automatically enables the only option so that
1176                       non-trailer lines in the trailer block are hidden. If
1177                       that is not desired it can be disabled with only=false.
1178                       E.g., %(trailers:key=Reviewed-by) shows trailer lines
1179                       with key Reviewed-by.
1180
1181                   ·   only[=val]: select whether non-trailer lines from the
1182                       trailer block should be included. The only keyword may
1183                       optionally be followed by an equal sign and one of
1184                       true, on, yes to omit or false, off, no to show the
1185                       non-trailer lines. If option is given without value it
1186                       is enabled. If given multiple times the last value is
1187                       used.
1188
1189                   ·   separator=<SEP>: specify a separator inserted between
1190                       trailer lines. When this option is not given each
1191                       trailer line is terminated with a line feed character.
1192                       The string SEP may contain the literal formatting codes
1193                       described above. To use comma as separator one must use
1194                       %x2C as it would otherwise be parsed as next option. If
1195                       separator option is given multiple times only the last
1196                       one is used. E.g., %(trailers:key=Ticket,separator=%x2C
1197                       ) shows all trailer lines whose key is "Ticket"
1198                       separated by a comma and a space.
1199
1200                   ·   unfold[=val]: make it behave as if interpret-trailer’s
1201                       --unfold option was given. In same way as to for only
1202                       it can be followed by an equal sign and explicit value.
1203                       E.g., %(trailers:only,unfold=true) unfolds and shows
1204                       all trailer lines.
1205
1206                   ·   valueonly[=val]: skip over the key part of the trailer
1207                       line and only show the value part. Also this optionally
1208                       allows explicit value.
1209
1210           Note
1211           Some placeholders may depend on other options given to the revision
1212           traversal engine. For example, the %g* reflog options will insert
1213           an empty string unless we are traversing reflog entries (e.g., by
1214           git log -g). The %d and %D placeholders will use the "short"
1215           decoration format if --decorate was not already provided on the
1216           command line.
1217
1218       If you add a + (plus sign) after % of a placeholder, a line-feed is
1219       inserted immediately before the expansion if and only if the
1220       placeholder expands to a non-empty string.
1221
1222       If you add a - (minus sign) after % of a placeholder, all consecutive
1223       line-feeds immediately preceding the expansion are deleted if and only
1224       if the placeholder expands to an empty string.
1225
1226       If you add a ` ` (space) after % of a placeholder, a space is inserted
1227       immediately before the expansion if and only if the placeholder expands
1228       to a non-empty string.
1229
1230       ·   tformat:
1231
1232           The tformat: format works exactly like format:, except that it
1233           provides "terminator" semantics instead of "separator" semantics.
1234           In other words, each commit has the message terminator character
1235           (usually a newline) appended, rather than a separator placed
1236           between entries. This means that the final entry of a single-line
1237           format will be properly terminated with a new line, just as the
1238           "oneline" format does. For example:
1239
1240               $ git log -2 --pretty=format:%h 4da45bef \
1241                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1242               4da45be
1243               7134973 -- NO NEWLINE
1244
1245               $ git log -2 --pretty=tformat:%h 4da45bef \
1246                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1247               4da45be
1248               7134973
1249
1250           In addition, any unrecognized string that has a % in it is
1251           interpreted as if it has tformat: in front of it. For example,
1252           these two are equivalent:
1253
1254               $ git log -2 --pretty=tformat:%h 4da45bef
1255               $ git log -2 --pretty=%h 4da45bef
1256
1257

RAW OUTPUT FORMAT

1259       The raw output format from "git-diff-index", "git-diff-tree",
1260       "git-diff-files" and "git diff --raw" are very similar.
1261
1262       These commands all compare two sets of things; what is compared
1263       differs:
1264
1265       git-diff-index <tree-ish>
1266           compares the <tree-ish> and the files on the filesystem.
1267
1268       git-diff-index --cached <tree-ish>
1269           compares the <tree-ish> and the index.
1270
1271       git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
1272           compares the trees named by the two arguments.
1273
1274       git-diff-files [<pattern>...]
1275           compares the index and the files on the filesystem.
1276
1277       The "git-diff-tree" command begins its output by printing the hash of
1278       what is being compared. After that, all the commands print one output
1279       line per changed file.
1280
1281       An output line is formatted this way:
1282
1283           in-place edit  :100644 100644 bcd1234 0123456 M file0
1284           copy-edit      :100644 100644 abcd123 1234567 C68 file1 file2
1285           rename-edit    :100644 100644 abcd123 1234567 R86 file1 file3
1286           create         :000000 100644 0000000 1234567 A file4
1287           delete         :100644 000000 1234567 0000000 D file5
1288           unmerged       :000000 000000 0000000 0000000 U file6
1289
1290
1291       That is, from the left to the right:
1292
1293        1. a colon.
1294
1295        2. mode for "src"; 000000 if creation or unmerged.
1296
1297        3. a space.
1298
1299        4. mode for "dst"; 000000 if deletion or unmerged.
1300
1301        5. a space.
1302
1303        6. sha1 for "src"; 0{40} if creation or unmerged.
1304
1305        7. a space.
1306
1307        8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1308
1309        9. a space.
1310
1311       10. status, followed by optional "score" number.
1312
1313       11. a tab or a NUL when -z option is used.
1314
1315       12. path for "src"
1316
1317       13. a tab or a NUL when -z option is used; only exists for C or R.
1318
1319       14. path for "dst"; only exists for C or R.
1320
1321       15. an LF or a NUL when -z option is used, to terminate the record.
1322
1323       Possible status letters are:
1324
1325       ·   A: addition of a file
1326
1327       ·   C: copy of a file into a new one
1328
1329       ·   D: deletion of a file
1330
1331       ·   M: modification of the contents or mode of a file
1332
1333       ·   R: renaming of a file
1334
1335       ·   T: change in the type of the file
1336
1337       ·   U: file is unmerged (you must complete the merge before it can be
1338           committed)
1339
1340       ·   X: "unknown" change type (most probably a bug, please report it)
1341
1342       Status letters C and R are always followed by a score (denoting the
1343       percentage of similarity between the source and target of the move or
1344       copy). Status letter M may be followed by a score (denoting the
1345       percentage of dissimilarity) for file rewrites.
1346
1347       <sha1> is shown as all 0’s if a file is new on the filesystem and it is
1348       out of sync with the index.
1349
1350       Example:
1351
1352           :100644 100644 5be4a4a 0000000 M file.c
1353
1354
1355       Without the -z option, pathnames with "unusual" characters are quoted
1356       as explained for the configuration variable core.quotePath (see git-
1357       config(1)). Using -z the filename is output verbatim and the line is
1358       terminated by a NUL byte.
1359

DIFF FORMAT FOR MERGES

1361       "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
1362       --cc option to generate diff output also for merge commits. The output
1363       differs from the format described above in the following way:
1364
1365        1. there is a colon for each parent
1366
1367        2. there are more "src" modes and "src" sha1
1368
1369        3. status is concatenated status characters for each parent
1370
1371        4. no optional "score" number
1372
1373        5. tab-separated pathname(s) of the file
1374
1375       For -c and --cc, only the destination or final path is shown even if
1376       the file was renamed on any side of history. With --combined-all-paths,
1377       the name of the path in each parent is shown followed by the name of
1378       the path in the merge commit.
1379
1380       Examples for -c and --cc without --combined-all-paths:
1381
1382           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       desc.c
1383           ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM       bar.sh
1384           ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR       phooey.c
1385
1386
1387       Examples when --combined-all-paths added to either -c or --cc:
1388
1389           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       desc.c  desc.c  desc.c
1390           ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM       foo.sh  bar.sh  bar.sh
1391           ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR       fooey.c fuey.c  phooey.c
1392
1393
1394       Note that combined diff lists only files which were modified from all
1395       parents.
1396

GENERATING PATCH TEXT WITH -P

1398       Running git-diff(1), git-log(1), git-show(1), git-diff-index(1), git-
1399       diff-tree(1), or git-diff-files(1) with the -p option produces patch
1400       text. You can customize the creation of patch text via the
1401       GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.
1402
1403       What the -p option produces is slightly different from the traditional
1404       diff format:
1405
1406        1. It is preceded with a "git diff" header that looks like this:
1407
1408               diff --git a/file1 b/file2
1409
1410           The a/ and b/ filenames are the same unless rename/copy is
1411           involved. Especially, even for a creation or a deletion, /dev/null
1412           is not used in place of the a/ or b/ filenames.
1413
1414           When rename/copy is involved, file1 and file2 show the name of the
1415           source file of the rename/copy and the name of the file that
1416           rename/copy produces, respectively.
1417
1418        2. It is followed by one or more extended header lines:
1419
1420               old mode <mode>
1421               new mode <mode>
1422               deleted file mode <mode>
1423               new file mode <mode>
1424               copy from <path>
1425               copy to <path>
1426               rename from <path>
1427               rename to <path>
1428               similarity index <number>
1429               dissimilarity index <number>
1430               index <hash>..<hash> <mode>
1431
1432           File modes are printed as 6-digit octal numbers including the file
1433           type and file permission bits.
1434
1435           Path names in extended headers do not include the a/ and b/
1436           prefixes.
1437
1438           The similarity index is the percentage of unchanged lines, and the
1439           dissimilarity index is the percentage of changed lines. It is a
1440           rounded down integer, followed by a percent sign. The similarity
1441           index value of 100% is thus reserved for two equal files, while
1442           100% dissimilarity means that no line from the old file made it
1443           into the new one.
1444
1445           The index line includes the blob object names before and after the
1446           change. The <mode> is included if the file mode does not change;
1447           otherwise, separate lines indicate the old and the new mode.
1448
1449        3. Pathnames with "unusual" characters are quoted as explained for the
1450           configuration variable core.quotePath (see git-config(1)).
1451
1452        4. All the file1 files in the output refer to files before the commit,
1453           and all the file2 files refer to files after the commit. It is
1454           incorrect to apply each change to each file sequentially. For
1455           example, this patch will swap a and b:
1456
1457               diff --git a/a b/b
1458               rename from a
1459               rename to b
1460               diff --git a/b b/a
1461               rename from b
1462               rename to a
1463

COMBINED DIFF FORMAT

1465       Any diff-generating command can take the -c or --cc option to produce a
1466       combined diff when showing a merge. This is the default format when
1467       showing merges with git-diff(1) or git-show(1). Note also that you can
1468       give the -m option to any of these commands to force generation of
1469       diffs with individual parents of a merge.
1470
1471       A "combined diff" format looks like this:
1472
1473           diff --combined describe.c
1474           index fabadb8,cc95eb0..4866510
1475           --- a/describe.c
1476           +++ b/describe.c
1477           @@@ -98,20 -98,12 +98,20 @@@
1478                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1479             }
1480
1481           - static void describe(char *arg)
1482            -static void describe(struct commit *cmit, int last_one)
1483           ++static void describe(char *arg, int last_one)
1484             {
1485            +      unsigned char sha1[20];
1486            +      struct commit *cmit;
1487                   struct commit_list *list;
1488                   static int initialized = 0;
1489                   struct commit_name *n;
1490
1491            +      if (get_sha1(arg, sha1) < 0)
1492            +              usage(describe_usage);
1493            +      cmit = lookup_commit_reference(sha1);
1494            +      if (!cmit)
1495            +              usage(describe_usage);
1496            +
1497                   if (!initialized) {
1498                           initialized = 1;
1499                           for_each_ref(get_name);
1500
1501
1502
1503        1. It is preceded with a "git diff" header, that looks like this (when
1504           the -c option is used):
1505
1506               diff --combined file
1507
1508           or like this (when the --cc option is used):
1509
1510               diff --cc file
1511
1512        2. It is followed by one or more extended header lines (this example
1513           shows a merge with two parents):
1514
1515               index <hash>,<hash>..<hash>
1516               mode <mode>,<mode>..<mode>
1517               new file mode <mode>
1518               deleted file mode <mode>,<mode>
1519
1520           The mode <mode>,<mode>..<mode> line appears only if at least one of
1521           the <mode> is different from the rest. Extended headers with
1522           information about detected contents movement (renames and copying
1523           detection) are designed to work with diff of two <tree-ish> and are
1524           not used by combined diff format.
1525
1526        3. It is followed by two-line from-file/to-file header
1527
1528               --- a/file
1529               +++ b/file
1530
1531           Similar to two-line header for traditional unified diff format,
1532           /dev/null is used to signal created or deleted files.
1533
1534           However, if the --combined-all-paths option is provided, instead of
1535           a two-line from-file/to-file you get a N+1 line from-file/to-file
1536           header, where N is the number of parents in the merge commit
1537
1538               --- a/file
1539               --- a/file
1540               --- a/file
1541               +++ b/file
1542
1543           This extended format can be useful if rename or copy detection is
1544           active, to allow you to see the original name of the file in
1545           different parents.
1546
1547        4. Chunk header format is modified to prevent people from accidentally
1548           feeding it to patch -p1. Combined diff format was created for
1549           review of merge commit changes, and was not meant to be applied.
1550           The change is similar to the change in the extended index header:
1551
1552               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1553
1554           There are (number of parents + 1) @ characters in the chunk header
1555           for combined diff format.
1556
1557       Unlike the traditional unified diff format, which shows two files A and
1558       B with a single column that has - (minus — appears in A but removed in
1559       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1560       prefix, this format compares two or more files file1, file2,... with
1561       one file X, and shows how X differs from each of fileN. One column for
1562       each of fileN is prepended to the output line to note how X’s line is
1563       different from it.
1564
1565       A - character in the column N means that the line appears in fileN but
1566       it does not appear in the result. A + character in the column N means
1567       that the line appears in the result, and fileN does not have that line
1568       (in other words, the line was added, from the point of view of that
1569       parent).
1570
1571       In the above example output, the function signature was changed from
1572       both files (hence two - removals from both file1 and file2, plus ++ to
1573       mean one line that was added does not appear in either file1 or file2).
1574       Also eight other lines are the same from file1 but do not appear in
1575       file2 (hence prefixed with +).
1576
1577       When shown by git diff-tree -c, it compares the parents of a merge
1578       commit with the merge result (i.e. file1..fileN are the parents). When
1579       shown by git diff-files -c, it compares the two unresolved merge
1580       parents with the working tree file (i.e. file1 is stage 2 aka "our
1581       version", file2 is stage 3 aka "their version").
1582

OTHER DIFF FORMATS

1584       The --summary option describes newly added, deleted, renamed and copied
1585       files. The --stat option adds diffstat(1) graph to the output. These
1586       options can be combined with other options, such as -p, and are meant
1587       for human consumption.
1588
1589       When showing a change that involves a rename or a copy, --stat output
1590       formats the pathnames compactly by combining common prefix and suffix
1591       of the pathnames. For example, a change that moves arch/i386/Makefile
1592       to arch/x86/Makefile while modifying 4 lines will be shown like this:
1593
1594           arch/{i386 => x86}/Makefile    |   4 +--
1595
1596
1597       The --numstat option gives the diffstat(1) information but is designed
1598       for easier machine consumption. An entry in --numstat output looks like
1599       this:
1600
1601           1       2       README
1602           3       1       arch/{i386 => x86}/Makefile
1603
1604
1605       That is, from left to right:
1606
1607        1. the number of added lines;
1608
1609        2. a tab;
1610
1611        3. the number of deleted lines;
1612
1613        4. a tab;
1614
1615        5. pathname (possibly with rename/copy information);
1616
1617        6. a newline.
1618
1619       When -z output option is in effect, the output is formatted this way:
1620
1621           1       2       README NUL
1622           3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
1623
1624
1625       That is:
1626
1627        1. the number of added lines;
1628
1629        2. a tab;
1630
1631        3. the number of deleted lines;
1632
1633        4. a tab;
1634
1635        5. a NUL (only exists if renamed/copied);
1636
1637        6. pathname in preimage;
1638
1639        7. a NUL (only exists if renamed/copied);
1640
1641        8. pathname in postimage (only exists if renamed/copied);
1642
1643        9. a NUL.
1644
1645       The extra NUL before the preimage path in renamed case is to allow
1646       scripts that read the output to tell if the current record being read
1647       is a single-path record or a rename/copy record without reading ahead.
1648       After reading added and deleted lines, reading up to NUL would yield
1649       the pathname, but if that is NUL, the record will show two paths.
1650

GIT

1652       Part of the git(1) suite
1653
1654
1655
1656Git 2.24.1                        12/10/2019                  GIT-DIFF-TREE(1)
Impressum