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

PRETTY FORMATS

797       If the commit is a merge, and if the pretty-format is not oneline,
798       email or raw, an additional line is inserted before the Author: line.
799       This line begins with "Merge: " and the sha1s of ancestral commits are
800       printed, separated by spaces. Note that the listed commits may not
801       necessarily be the list of the direct parent commits if you have
802       limited your view of history: for example, if you are only interested
803       in changes related to a certain directory or file.
804
805       There are several built-in formats, and you can define additional
806       formats by setting a pretty.<name> config option to either another
807       format name, or a format: string, as described below (see git-
808       config(1)). Here are the details of the built-in formats:
809
810       ·   oneline
811
812               <sha1> <title line>
813
814           This is designed to be as compact as possible.
815
816       ·   short
817
818               commit <sha1>
819               Author: <author>
820
821               <title line>
822
823       ·   medium
824
825               commit <sha1>
826               Author: <author>
827               Date:   <author date>
828
829               <title line>
830
831               <full commit message>
832
833       ·   full
834
835               commit <sha1>
836               Author: <author>
837               Commit: <committer>
838
839               <title line>
840
841               <full commit message>
842
843       ·   fuller
844
845               commit <sha1>
846               Author:     <author>
847               AuthorDate: <author date>
848               Commit:     <committer>
849               CommitDate: <committer date>
850
851               <title line>
852
853               <full commit message>
854
855       ·   email
856
857               From <sha1> <date>
858               From: <author>
859               Date: <author date>
860               Subject: [PATCH] <title line>
861
862               <full commit message>
863
864       ·   raw
865
866           The raw format shows the entire commit exactly as stored in the
867           commit object. Notably, the SHA-1s are displayed in full,
868           regardless of whether --abbrev or --no-abbrev are used, and parents
869           information show the true parent commits, without taking grafts or
870           history simplification into account. Note that this format affects
871           the way commits are displayed, but not the way the diff is shown
872           e.g. with git log --raw. To get full object names in a raw diff
873           format, use --no-abbrev.
874
875       ·   format:<string>
876
877           The format:<string> format allows you to specify which information
878           you want to show. It works a little bit like printf format, with
879           the notable exception that you get a newline with %n instead of \n.
880
881           E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
882           would show something like this:
883
884               The author of fe6e0ee was Junio C Hamano, 23 hours ago
885               The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
886
887           The placeholders are:
888
889           ·   %H: commit hash
890
891           ·   %h: abbreviated commit hash
892
893           ·   %T: tree hash
894
895           ·   %t: abbreviated tree hash
896
897           ·   %P: parent hashes
898
899           ·   %p: abbreviated parent hashes
900
901           ·   %an: author name
902
903           ·   %aN: author name (respecting .mailmap, see git-shortlog(1) or
904               git-blame(1))
905
906           ·   %ae: author email
907
908           ·   %aE: author email (respecting .mailmap, see git-shortlog(1) or
909               git-blame(1))
910
911           ·   %ad: author date (format respects --date= option)
912
913           ·   %aD: author date, RFC2822 style
914
915           ·   %ar: author date, relative
916
917           ·   %at: author date, UNIX timestamp
918
919           ·   %ai: author date, ISO 8601-like format
920
921           ·   %aI: author date, strict ISO 8601 format
922
923           ·   %cn: committer name
924
925           ·   %cN: committer name (respecting .mailmap, see git-shortlog(1)
926               or git-blame(1))
927
928           ·   %ce: committer email
929
930           ·   %cE: committer email (respecting .mailmap, see git-shortlog(1)
931               or git-blame(1))
932
933           ·   %cd: committer date (format respects --date= option)
934
935           ·   %cD: committer date, RFC2822 style
936
937           ·   %cr: committer date, relative
938
939           ·   %ct: committer date, UNIX timestamp
940
941           ·   %ci: committer date, ISO 8601-like format
942
943           ·   %cI: committer date, strict ISO 8601 format
944
945           ·   %d: ref names, like the --decorate option of git-log(1)
946
947           ·   %D: ref names without the " (", ")" wrapping.
948
949           ·   %e: encoding
950
951           ·   %s: subject
952
953           ·   %f: sanitized subject line, suitable for a filename
954
955           ·   %b: body
956
957           ·   %B: raw body (unwrapped subject and body)
958
959           ·   %N: commit notes
960
961           ·   %GG: raw verification message from GPG for a signed commit
962
963           ·   %G?: show "G" for a good (valid) signature, "B" for a bad
964               signature, "U" for a good signature with unknown validity, "X"
965               for a good signature that has expired, "Y" for a good signature
966               made by an expired key, "R" for a good signature made by a
967               revoked key, "E" if the signature cannot be checked (e.g.
968               missing key) and "N" for no signature
969
970           ·   %GS: show the name of the signer for a signed commit
971
972           ·   %GK: show the key used to sign a signed commit
973
974           ·   %GF: show the fingerprint of the key used to sign a signed
975               commit
976
977           ·   %GP: show the fingerprint of the primary key whose subkey was
978               used to sign a signed commit
979
980           ·   %gD: reflog selector, e.g., refs/stash@{1} or refs/stash@{2
981               minutes ago}; the format follows the rules described for the -g
982               option. The portion before the @ is the refname as given on the
983               command line (so git log -g refs/heads/master would yield
984               refs/heads/master@{0}).
985
986           ·   %gd: shortened reflog selector; same as %gD, but the refname
987               portion is shortened for human readability (so
988               refs/heads/master becomes just master).
989
990           ·   %gn: reflog identity name
991
992           ·   %gN: reflog identity name (respecting .mailmap, see git-
993               shortlog(1) or git-blame(1))
994
995           ·   %ge: reflog identity email
996
997           ·   %gE: reflog identity email (respecting .mailmap, see git-
998               shortlog(1) or git-blame(1))
999
1000           ·   %gs: reflog subject
1001
1002           ·   %Cred: switch color to red
1003
1004           ·   %Cgreen: switch color to green
1005
1006           ·   %Cblue: switch color to blue
1007
1008           ·   %Creset: reset color
1009
1010           ·   %C(...): color specification, as described under Values in the
1011               "CONFIGURATION FILE" section of git-config(1). By default,
1012               colors are shown only when enabled for log output (by
1013               color.diff, color.ui, or --color, and respecting the auto
1014               settings of the former if we are going to a terminal).
1015               %C(auto,...)  is accepted as a historical synonym for the
1016               default (e.g., %C(auto,red)). Specifying %C(always,...) will
1017               show the colors even when color is not otherwise enabled
1018               (though consider just using `--color=always to enable color for
1019               the whole output, including this format and anything else git
1020               might color).  auto alone (i.e.  %C(auto)) will turn on auto
1021               coloring on the next placeholders until the color is switched
1022               again.
1023
1024           ·   %m: left (<), right (>) or boundary (-) mark
1025
1026           ·   %n: newline
1027
1028           ·   %%: a raw %
1029
1030           ·   %x00: print a byte from a hex code
1031
1032           ·   %w([<w>[,<i1>[,<i2>]]]): switch line wrapping, like the -w
1033               option of git-shortlog(1).
1034
1035           ·   %<(<N>[,trunc|ltrunc|mtrunc]): make the next placeholder take
1036               at least N columns, padding spaces on the right if necessary.
1037               Optionally truncate at the beginning (ltrunc), the middle
1038               (mtrunc) or the end (trunc) if the output is longer than N
1039               columns. Note that truncating only works correctly with N >= 2.
1040
1041           ·   %<|(<N>): make the next placeholder take at least until Nth
1042               columns, padding spaces on the right if necessary
1043
1044           ·   %>(<N>), %>|(<N>): similar to %<(<N>), %<|(<N>) respectively,
1045               but padding spaces on the left
1046
1047           ·   %>>(<N>), %>>|(<N>): similar to %>(<N>), %>|(<N>) respectively,
1048               except that if the next placeholder takes more spaces than
1049               given and there are spaces on its left, use those spaces
1050
1051           ·   %><(<N>), %><|(<N>): similar to %<(<N>), %<|(<N>) respectively,
1052               but padding both sides (i.e. the text is centered)
1053
1054           ·   %(trailers[:options]): display the trailers of the body as
1055               interpreted by git-interpret-trailers(1). The trailers string
1056               may be followed by a colon and zero or more comma-separated
1057               options. If the only option is given, omit non-trailer lines
1058               from the trailer block. If the unfold option is given, behave
1059               as if interpret-trailer’s --unfold option was given. E.g.,
1060               %(trailers:only,unfold) to do both.
1061
1062           Note
1063           Some placeholders may depend on other options given to the revision
1064           traversal engine. For example, the %g* reflog options will insert
1065           an empty string unless we are traversing reflog entries (e.g., by
1066           git log -g). The %d and %D placeholders will use the "short"
1067           decoration format if --decorate was not already provided on the
1068           command line.
1069
1070       If you add a + (plus sign) after % of a placeholder, a line-feed is
1071       inserted immediately before the expansion if and only if the
1072       placeholder expands to a non-empty string.
1073
1074       If you add a - (minus sign) after % of a placeholder, all consecutive
1075       line-feeds immediately preceding the expansion are deleted if and only
1076       if the placeholder expands to an empty string.
1077
1078       If you add a ` ` (space) after % of a placeholder, a space is inserted
1079       immediately before the expansion if and only if the placeholder expands
1080       to a non-empty string.
1081
1082       ·   tformat:
1083
1084           The tformat: format works exactly like format:, except that it
1085           provides "terminator" semantics instead of "separator" semantics.
1086           In other words, each commit has the message terminator character
1087           (usually a newline) appended, rather than a separator placed
1088           between entries. This means that the final entry of a single-line
1089           format will be properly terminated with a new line, just as the
1090           "oneline" format does. For example:
1091
1092               $ git log -2 --pretty=format:%h 4da45bef \
1093                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1094               4da45be
1095               7134973 -- NO NEWLINE
1096
1097               $ git log -2 --pretty=tformat:%h 4da45bef \
1098                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1099               4da45be
1100               7134973
1101
1102           In addition, any unrecognized string that has a % in it is
1103           interpreted as if it has tformat: in front of it. For example,
1104           these two are equivalent:
1105
1106               $ git log -2 --pretty=tformat:%h 4da45bef
1107               $ git log -2 --pretty=%h 4da45bef
1108
1109

LIMITING OUTPUT

1111       If you’re only interested in differences in a subset of files, for
1112       example some architecture-specific files, you might do:
1113
1114           git diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64
1115
1116       and it will only show you what changed in those two directories.
1117
1118       Or if you are searching for what changed in just kernel/sched.c, just
1119       do
1120
1121           git diff-tree -r <tree-ish> <tree-ish> kernel/sched.c
1122
1123       and it will ignore all differences to other files.
1124
1125       The pattern is always the prefix, and is matched exactly. There are no
1126       wildcards. Even stricter, it has to match a complete path component.
1127       I.e. "foo" does not pick up foobar.h. "foo" does match foo/bar.h so it
1128       can be used to name subdirectories.
1129
1130       An example of normal usage is:
1131
1132           torvalds@ppc970:~/git> git diff-tree --abbrev 5319e4
1133           :100664 100664 ac348b... a01513...    git-fsck-objects.c
1134
1135       which tells you that the last commit changed just one file (it’s from
1136       this one:
1137
1138           commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
1139           tree 5319e4d609cdd282069cc4dce33c1db559539b03
1140           parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
1141           author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005
1142           committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005
1143
1144           Make "git-fsck-objects" print out all the root commits it finds.
1145
1146           Once I do the reference tracking, I'll also make it print out all the
1147           HEAD commits it finds, which is even more interesting.
1148
1149
1150       in case you care).
1151

RAW OUTPUT FORMAT

1153       The raw output format from "git-diff-index", "git-diff-tree",
1154       "git-diff-files" and "git diff --raw" are very similar.
1155
1156       These commands all compare two sets of things; what is compared
1157       differs:
1158
1159       git-diff-index <tree-ish>
1160           compares the <tree-ish> and the files on the filesystem.
1161
1162       git-diff-index --cached <tree-ish>
1163           compares the <tree-ish> and the index.
1164
1165       git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
1166           compares the trees named by the two arguments.
1167
1168       git-diff-files [<pattern>...]
1169           compares the index and the files on the filesystem.
1170
1171       The "git-diff-tree" command begins its output by printing the hash of
1172       what is being compared. After that, all the commands print one output
1173       line per changed file.
1174
1175       An output line is formatted this way:
1176
1177           in-place edit  :100644 100644 bcd1234 0123456 M file0
1178           copy-edit      :100644 100644 abcd123 1234567 C68 file1 file2
1179           rename-edit    :100644 100644 abcd123 1234567 R86 file1 file3
1180           create         :000000 100644 0000000 1234567 A file4
1181           delete         :100644 000000 1234567 0000000 D file5
1182           unmerged       :000000 000000 0000000 0000000 U file6
1183
1184
1185       That is, from the left to the right:
1186
1187        1. a colon.
1188
1189        2. mode for "src"; 000000 if creation or unmerged.
1190
1191        3. a space.
1192
1193        4. mode for "dst"; 000000 if deletion or unmerged.
1194
1195        5. a space.
1196
1197        6. sha1 for "src"; 0{40} if creation or unmerged.
1198
1199        7. a space.
1200
1201        8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1202
1203        9. a space.
1204
1205       10. status, followed by optional "score" number.
1206
1207       11. a tab or a NUL when -z option is used.
1208
1209       12. path for "src"
1210
1211       13. a tab or a NUL when -z option is used; only exists for C or R.
1212
1213       14. path for "dst"; only exists for C or R.
1214
1215       15. an LF or a NUL when -z option is used, to terminate the record.
1216
1217       Possible status letters are:
1218
1219       ·   A: addition of a file
1220
1221       ·   C: copy of a file into a new one
1222
1223       ·   D: deletion of a file
1224
1225       ·   M: modification of the contents or mode of a file
1226
1227       ·   R: renaming of a file
1228
1229       ·   T: change in the type of the file
1230
1231       ·   U: file is unmerged (you must complete the merge before it can be
1232           committed)
1233
1234       ·   X: "unknown" change type (most probably a bug, please report it)
1235
1236       Status letters C and R are always followed by a score (denoting the
1237       percentage of similarity between the source and target of the move or
1238       copy). Status letter M may be followed by a score (denoting the
1239       percentage of dissimilarity) for file rewrites.
1240
1241       <sha1> is shown as all 0’s if a file is new on the filesystem and it is
1242       out of sync with the index.
1243
1244       Example:
1245
1246           :100644 100644 5be4a4a 0000000 M file.c
1247
1248
1249       Without the -z option, pathnames with "unusual" characters are quoted
1250       as explained for the configuration variable core.quotePath (see git-
1251       config(1)). Using -z the filename is output verbatim and the line is
1252       terminated by a NUL byte.
1253

DIFF FORMAT FOR MERGES

1255       "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
1256       --cc option to generate diff output also for merge commits. The output
1257       differs from the format described above in the following way:
1258
1259        1. there is a colon for each parent
1260
1261        2. there are more "src" modes and "src" sha1
1262
1263        3. status is concatenated status characters for each parent
1264
1265        4. no optional "score" number
1266
1267        5. single path, only for "dst"
1268
1269       Example:
1270
1271           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       describe.c
1272
1273
1274       Note that combined diff lists only files which were modified from all
1275       parents.
1276

GENERATING PATCHES WITH -P

1278       When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1279       with a -p option, "git diff" without the --raw option, or "git log"
1280       with the "-p" option, they do not produce the output described above;
1281       instead they produce a patch file. You can customize the creation of
1282       such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
1283       environment variables.
1284
1285       What the -p option produces is slightly different from the traditional
1286       diff format:
1287
1288        1. It is preceded with a "git diff" header that looks like this:
1289
1290               diff --git a/file1 b/file2
1291
1292           The a/ and b/ filenames are the same unless rename/copy is
1293           involved. Especially, even for a creation or a deletion, /dev/null
1294           is not used in place of the a/ or b/ filenames.
1295
1296           When rename/copy is involved, file1 and file2 show the name of the
1297           source file of the rename/copy and the name of the file that
1298           rename/copy produces, respectively.
1299
1300        2. It is followed by one or more extended header lines:
1301
1302               old mode <mode>
1303               new mode <mode>
1304               deleted file mode <mode>
1305               new file mode <mode>
1306               copy from <path>
1307               copy to <path>
1308               rename from <path>
1309               rename to <path>
1310               similarity index <number>
1311               dissimilarity index <number>
1312               index <hash>..<hash> <mode>
1313
1314           File modes are printed as 6-digit octal numbers including the file
1315           type and file permission bits.
1316
1317           Path names in extended headers do not include the a/ and b/
1318           prefixes.
1319
1320           The similarity index is the percentage of unchanged lines, and the
1321           dissimilarity index is the percentage of changed lines. It is a
1322           rounded down integer, followed by a percent sign. The similarity
1323           index value of 100% is thus reserved for two equal files, while
1324           100% dissimilarity means that no line from the old file made it
1325           into the new one.
1326
1327           The index line includes the SHA-1 checksum before and after the
1328           change. The <mode> is included if the file mode does not change;
1329           otherwise, separate lines indicate the old and the new mode.
1330
1331        3. Pathnames with "unusual" characters are quoted as explained for the
1332           configuration variable core.quotePath (see git-config(1)).
1333
1334        4. All the file1 files in the output refer to files before the commit,
1335           and all the file2 files refer to files after the commit. It is
1336           incorrect to apply each change to each file sequentially. For
1337           example, this patch will swap a and b:
1338
1339               diff --git a/a b/b
1340               rename from a
1341               rename to b
1342               diff --git a/b b/a
1343               rename from b
1344               rename to a
1345

COMBINED DIFF FORMAT

1347       Any diff-generating command can take the -c or --cc option to produce a
1348       combined diff when showing a merge. This is the default format when
1349       showing merges with git-diff(1) or git-show(1). Note also that you can
1350       give the -m option to any of these commands to force generation of
1351       diffs with individual parents of a merge.
1352
1353       A combined diff format looks like this:
1354
1355           diff --combined describe.c
1356           index fabadb8,cc95eb0..4866510
1357           --- a/describe.c
1358           +++ b/describe.c
1359           @@@ -98,20 -98,12 +98,20 @@@
1360                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1361             }
1362
1363           - static void describe(char *arg)
1364            -static void describe(struct commit *cmit, int last_one)
1365           ++static void describe(char *arg, int last_one)
1366             {
1367            +      unsigned char sha1[20];
1368            +      struct commit *cmit;
1369                   struct commit_list *list;
1370                   static int initialized = 0;
1371                   struct commit_name *n;
1372
1373            +      if (get_sha1(arg, sha1) < 0)
1374            +              usage(describe_usage);
1375            +      cmit = lookup_commit_reference(sha1);
1376            +      if (!cmit)
1377            +              usage(describe_usage);
1378            +
1379                   if (!initialized) {
1380                           initialized = 1;
1381                           for_each_ref(get_name);
1382
1383
1384
1385        1. It is preceded with a "git diff" header, that looks like this (when
1386           -c option is used):
1387
1388               diff --combined file
1389
1390           or like this (when --cc option is used):
1391
1392               diff --cc file
1393
1394        2. It is followed by one or more extended header lines (this example
1395           shows a merge with two parents):
1396
1397               index <hash>,<hash>..<hash>
1398               mode <mode>,<mode>..<mode>
1399               new file mode <mode>
1400               deleted file mode <mode>,<mode>
1401
1402           The mode <mode>,<mode>..<mode> line appears only if at least one of
1403           the <mode> is different from the rest. Extended headers with
1404           information about detected contents movement (renames and copying
1405           detection) are designed to work with diff of two <tree-ish> and are
1406           not used by combined diff format.
1407
1408        3. It is followed by two-line from-file/to-file header
1409
1410               --- a/file
1411               +++ b/file
1412
1413           Similar to two-line header for traditional unified diff format,
1414           /dev/null is used to signal created or deleted files.
1415
1416        4. Chunk header format is modified to prevent people from accidentally
1417           feeding it to patch -p1. Combined diff format was created for
1418           review of merge commit changes, and was not meant for apply. The
1419           change is similar to the change in the extended index header:
1420
1421               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1422
1423           There are (number of parents + 1) @ characters in the chunk header
1424           for combined diff format.
1425
1426       Unlike the traditional unified diff format, which shows two files A and
1427       B with a single column that has - (minus — appears in A but removed in
1428       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1429       prefix, this format compares two or more files file1, file2,... with
1430       one file X, and shows how X differs from each of fileN. One column for
1431       each of fileN is prepended to the output line to note how X’s line is
1432       different from it.
1433
1434       A - character in the column N means that the line appears in fileN but
1435       it does not appear in the result. A + character in the column N means
1436       that the line appears in the result, and fileN does not have that line
1437       (in other words, the line was added, from the point of view of that
1438       parent).
1439
1440       In the above example output, the function signature was changed from
1441       both files (hence two - removals from both file1 and file2, plus ++ to
1442       mean one line that was added does not appear in either file1 or file2).
1443       Also eight other lines are the same from file1 but do not appear in
1444       file2 (hence prefixed with +).
1445
1446       When shown by git diff-tree -c, it compares the parents of a merge
1447       commit with the merge result (i.e. file1..fileN are the parents). When
1448       shown by git diff-files -c, it compares the two unresolved merge
1449       parents with the working tree file (i.e. file1 is stage 2 aka "our
1450       version", file2 is stage 3 aka "their version").
1451

OTHER DIFF FORMATS

1453       The --summary option describes newly added, deleted, renamed and copied
1454       files. The --stat option adds diffstat(1) graph to the output. These
1455       options can be combined with other options, such as -p, and are meant
1456       for human consumption.
1457
1458       When showing a change that involves a rename or a copy, --stat output
1459       formats the pathnames compactly by combining common prefix and suffix
1460       of the pathnames. For example, a change that moves arch/i386/Makefile
1461       to arch/x86/Makefile while modifying 4 lines will be shown like this:
1462
1463           arch/{i386 => x86}/Makefile    |   4 +--
1464
1465
1466       The --numstat option gives the diffstat(1) information but is designed
1467       for easier machine consumption. An entry in --numstat output looks like
1468       this:
1469
1470           1       2       README
1471           3       1       arch/{i386 => x86}/Makefile
1472
1473
1474       That is, from left to right:
1475
1476        1. the number of added lines;
1477
1478        2. a tab;
1479
1480        3. the number of deleted lines;
1481
1482        4. a tab;
1483
1484        5. pathname (possibly with rename/copy information);
1485
1486        6. a newline.
1487
1488       When -z output option is in effect, the output is formatted this way:
1489
1490           1       2       README NUL
1491           3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
1492
1493
1494       That is:
1495
1496        1. the number of added lines;
1497
1498        2. a tab;
1499
1500        3. the number of deleted lines;
1501
1502        4. a tab;
1503
1504        5. a NUL (only exists if renamed/copied);
1505
1506        6. pathname in preimage;
1507
1508        7. a NUL (only exists if renamed/copied);
1509
1510        8. pathname in postimage (only exists if renamed/copied);
1511
1512        9. a NUL.
1513
1514       The extra NUL before the preimage path in renamed case is to allow
1515       scripts that read the output to tell if the current record being read
1516       is a single-path record or a rename/copy record without reading ahead.
1517       After reading added and deleted lines, reading up to NUL would yield
1518       the pathname, but if that is NUL, the record will show two paths.
1519

GIT

1521       Part of the git(1) suite
1522
1523
1524
1525Git 2.20.1                        12/15/2018                  GIT-DIFF-TREE(1)
Impressum