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] [--merge-base]
12                     [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]
13

DESCRIPTION

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

OPTIONS

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

PRETTY FORMATS

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

RAW OUTPUT FORMAT

1314       The raw output format from "git-diff-index", "git-diff-tree",
1315       "git-diff-files" and "git diff --raw" are very similar.
1316
1317       These commands all compare two sets of things; what is compared
1318       differs:
1319
1320       git-diff-index <tree-ish>
1321           compares the <tree-ish> and the files on the filesystem.
1322
1323       git-diff-index --cached <tree-ish>
1324           compares the <tree-ish> and the index.
1325
1326       git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
1327           compares the trees named by the two arguments.
1328
1329       git-diff-files [<pattern>...]
1330           compares the index and the files on the filesystem.
1331
1332       The "git-diff-tree" command begins its output by printing the hash of
1333       what is being compared. After that, all the commands print one output
1334       line per changed file.
1335
1336       An output line is formatted this way:
1337
1338           in-place edit  :100644 100644 bcd1234 0123456 M file0
1339           copy-edit      :100644 100644 abcd123 1234567 C68 file1 file2
1340           rename-edit    :100644 100644 abcd123 1234567 R86 file1 file3
1341           create         :000000 100644 0000000 1234567 A file4
1342           delete         :100644 000000 1234567 0000000 D file5
1343           unmerged       :000000 000000 0000000 0000000 U file6
1344
1345       That is, from the left to the right:
1346
1347        1. a colon.
1348
1349        2. mode for "src"; 000000 if creation or unmerged.
1350
1351        3. a space.
1352
1353        4. mode for "dst"; 000000 if deletion or unmerged.
1354
1355        5. a space.
1356
1357        6. sha1 for "src"; 0{40} if creation or unmerged.
1358
1359        7. a space.
1360
1361        8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1362
1363        9. a space.
1364
1365       10. status, followed by optional "score" number.
1366
1367       11. a tab or a NUL when -z option is used.
1368
1369       12. path for "src"
1370
1371       13. a tab or a NUL when -z option is used; only exists for C or R.
1372
1373       14. path for "dst"; only exists for C or R.
1374
1375       15. an LF or a NUL when -z option is used, to terminate the record.
1376
1377       Possible status letters are:
1378
1379       ·   A: addition of a file
1380
1381       ·   C: copy of a file into a new one
1382
1383       ·   D: deletion of a file
1384
1385       ·   M: modification of the contents or mode of a file
1386
1387       ·   R: renaming of a file
1388
1389       ·   T: change in the type of the file
1390
1391       ·   U: file is unmerged (you must complete the merge before it can be
1392           committed)
1393
1394       ·   X: "unknown" change type (most probably a bug, please report it)
1395
1396       Status letters C and R are always followed by a score (denoting the
1397       percentage of similarity between the source and target of the move or
1398       copy). Status letter M may be followed by a score (denoting the
1399       percentage of dissimilarity) for file rewrites.
1400
1401       <sha1> is shown as all 0’s if a file is new on the filesystem and it is
1402       out of sync with the index.
1403
1404       Example:
1405
1406           :100644 100644 5be4a4a 0000000 M file.c
1407
1408       Without the -z option, pathnames with "unusual" characters are quoted
1409       as explained for the configuration variable core.quotePath (see git-
1410       config(1)). Using -z the filename is output verbatim and the line is
1411       terminated by a NUL byte.
1412

DIFF FORMAT FOR MERGES

1414       "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
1415       --cc option to generate diff output also for merge commits. The output
1416       differs from the format described above in the following way:
1417
1418        1. there is a colon for each parent
1419
1420        2. there are more "src" modes and "src" sha1
1421
1422        3. status is concatenated status characters for each parent
1423
1424        4. no optional "score" number
1425
1426        5. tab-separated pathname(s) of the file
1427
1428       For -c and --cc, only the destination or final path is shown even if
1429       the file was renamed on any side of history. With --combined-all-paths,
1430       the name of the path in each parent is shown followed by the name of
1431       the path in the merge commit.
1432
1433       Examples for -c and --cc without --combined-all-paths:
1434
1435           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       desc.c
1436           ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM       bar.sh
1437           ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR       phooey.c
1438
1439       Examples when --combined-all-paths added to either -c or --cc:
1440
1441           ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM       desc.c  desc.c  desc.c
1442           ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM       foo.sh  bar.sh  bar.sh
1443           ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR       fooey.c fuey.c  phooey.c
1444
1445       Note that combined diff lists only files which were modified from all
1446       parents.
1447

GENERATING PATCH TEXT WITH -P

1449       Running git-diff(1), git-log(1), git-show(1), git-diff-index(1), git-
1450       diff-tree(1), or git-diff-files(1) with the -p option produces patch
1451       text. You can customize the creation of patch text via the
1452       GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables (see
1453       git(1)).
1454
1455       What the -p option produces is slightly different from the traditional
1456       diff format:
1457
1458        1. It is preceded with a "git diff" header that looks like this:
1459
1460               diff --git a/file1 b/file2
1461
1462           The a/ and b/ filenames are the same unless rename/copy is
1463           involved. Especially, even for a creation or a deletion, /dev/null
1464           is not used in place of the a/ or b/ filenames.
1465
1466           When rename/copy is involved, file1 and file2 show the name of the
1467           source file of the rename/copy and the name of the file that
1468           rename/copy produces, respectively.
1469
1470        2. It is followed by one or more extended header lines:
1471
1472               old mode <mode>
1473               new mode <mode>
1474               deleted file mode <mode>
1475               new file mode <mode>
1476               copy from <path>
1477               copy to <path>
1478               rename from <path>
1479               rename to <path>
1480               similarity index <number>
1481               dissimilarity index <number>
1482               index <hash>..<hash> <mode>
1483
1484           File modes are printed as 6-digit octal numbers including the file
1485           type and file permission bits.
1486
1487           Path names in extended headers do not include the a/ and b/
1488           prefixes.
1489
1490           The similarity index is the percentage of unchanged lines, and the
1491           dissimilarity index is the percentage of changed lines. It is a
1492           rounded down integer, followed by a percent sign. The similarity
1493           index value of 100% is thus reserved for two equal files, while
1494           100% dissimilarity means that no line from the old file made it
1495           into the new one.
1496
1497           The index line includes the blob object names before and after the
1498           change. The <mode> is included if the file mode does not change;
1499           otherwise, separate lines indicate the old and the new mode.
1500
1501        3. Pathnames with "unusual" characters are quoted as explained for the
1502           configuration variable core.quotePath (see git-config(1)).
1503
1504        4. All the file1 files in the output refer to files before the commit,
1505           and all the file2 files refer to files after the commit. It is
1506           incorrect to apply each change to each file sequentially. For
1507           example, this patch will swap a and b:
1508
1509               diff --git a/a b/b
1510               rename from a
1511               rename to b
1512               diff --git a/b b/a
1513               rename from b
1514               rename to a
1515

COMBINED DIFF FORMAT

1517       Any diff-generating command can take the -c or --cc option to produce a
1518       combined diff when showing a merge. This is the default format when
1519       showing merges with git-diff(1) or git-show(1). Note also that you can
1520       give the -m option to any of these commands to force generation of
1521       diffs with individual parents of a merge.
1522
1523       A "combined diff" format looks like this:
1524
1525           diff --combined describe.c
1526           index fabadb8,cc95eb0..4866510
1527           --- a/describe.c
1528           +++ b/describe.c
1529           @@@ -98,20 -98,12 +98,20 @@@
1530                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1531             }
1532
1533           - static void describe(char *arg)
1534            -static void describe(struct commit *cmit, int last_one)
1535           ++static void describe(char *arg, int last_one)
1536             {
1537            +      unsigned char sha1[20];
1538            +      struct commit *cmit;
1539                   struct commit_list *list;
1540                   static int initialized = 0;
1541                   struct commit_name *n;
1542
1543            +      if (get_sha1(arg, sha1) < 0)
1544            +              usage(describe_usage);
1545            +      cmit = lookup_commit_reference(sha1);
1546            +      if (!cmit)
1547            +              usage(describe_usage);
1548            +
1549                   if (!initialized) {
1550                           initialized = 1;
1551                           for_each_ref(get_name);
1552
1553        1. It is preceded with a "git diff" header, that looks like this (when
1554           the -c option is used):
1555
1556               diff --combined file
1557
1558           or like this (when the --cc option is used):
1559
1560               diff --cc file
1561
1562        2. It is followed by one or more extended header lines (this example
1563           shows a merge with two parents):
1564
1565               index <hash>,<hash>..<hash>
1566               mode <mode>,<mode>..<mode>
1567               new file mode <mode>
1568               deleted file mode <mode>,<mode>
1569
1570           The mode <mode>,<mode>..<mode> line appears only if at least one of
1571           the <mode> is different from the rest. Extended headers with
1572           information about detected contents movement (renames and copying
1573           detection) are designed to work with diff of two <tree-ish> and are
1574           not used by combined diff format.
1575
1576        3. It is followed by two-line from-file/to-file header
1577
1578               --- a/file
1579               +++ b/file
1580
1581           Similar to two-line header for traditional unified diff format,
1582           /dev/null is used to signal created or deleted files.
1583
1584           However, if the --combined-all-paths option is provided, instead of
1585           a two-line from-file/to-file you get a N+1 line from-file/to-file
1586           header, where N is the number of parents in the merge commit
1587
1588               --- a/file
1589               --- a/file
1590               --- a/file
1591               +++ b/file
1592
1593           This extended format can be useful if rename or copy detection is
1594           active, to allow you to see the original name of the file in
1595           different parents.
1596
1597        4. Chunk header format is modified to prevent people from accidentally
1598           feeding it to patch -p1. Combined diff format was created for
1599           review of merge commit changes, and was not meant to be applied.
1600           The change is similar to the change in the extended index header:
1601
1602               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1603
1604           There are (number of parents + 1) @ characters in the chunk header
1605           for combined diff format.
1606
1607       Unlike the traditional unified diff format, which shows two files A and
1608       B with a single column that has - (minus — appears in A but removed in
1609       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1610       prefix, this format compares two or more files file1, file2,... with
1611       one file X, and shows how X differs from each of fileN. One column for
1612       each of fileN is prepended to the output line to note how X’s line is
1613       different from it.
1614
1615       A - character in the column N means that the line appears in fileN but
1616       it does not appear in the result. A + character in the column N means
1617       that the line appears in the result, and fileN does not have that line
1618       (in other words, the line was added, from the point of view of that
1619       parent).
1620
1621       In the above example output, the function signature was changed from
1622       both files (hence two - removals from both file1 and file2, plus ++ to
1623       mean one line that was added does not appear in either file1 or file2).
1624       Also eight other lines are the same from file1 but do not appear in
1625       file2 (hence prefixed with +).
1626
1627       When shown by git diff-tree -c, it compares the parents of a merge
1628       commit with the merge result (i.e. file1..fileN are the parents). When
1629       shown by git diff-files -c, it compares the two unresolved merge
1630       parents with the working tree file (i.e. file1 is stage 2 aka "our
1631       version", file2 is stage 3 aka "their version").
1632

OTHER DIFF FORMATS

1634       The --summary option describes newly added, deleted, renamed and copied
1635       files. The --stat option adds diffstat(1) graph to the output. These
1636       options can be combined with other options, such as -p, and are meant
1637       for human consumption.
1638
1639       When showing a change that involves a rename or a copy, --stat output
1640       formats the pathnames compactly by combining common prefix and suffix
1641       of the pathnames. For example, a change that moves arch/i386/Makefile
1642       to arch/x86/Makefile while modifying 4 lines will be shown like this:
1643
1644           arch/{i386 => x86}/Makefile    |   4 +--
1645
1646       The --numstat option gives the diffstat(1) information but is designed
1647       for easier machine consumption. An entry in --numstat output looks like
1648       this:
1649
1650           1       2       README
1651           3       1       arch/{i386 => x86}/Makefile
1652
1653       That is, from left to right:
1654
1655        1. the number of added lines;
1656
1657        2. a tab;
1658
1659        3. the number of deleted lines;
1660
1661        4. a tab;
1662
1663        5. pathname (possibly with rename/copy information);
1664
1665        6. a newline.
1666
1667       When -z output option is in effect, the output is formatted this way:
1668
1669           1       2       README NUL
1670           3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
1671
1672       That is:
1673
1674        1. the number of added lines;
1675
1676        2. a tab;
1677
1678        3. the number of deleted lines;
1679
1680        4. a tab;
1681
1682        5. a NUL (only exists if renamed/copied);
1683
1684        6. pathname in preimage;
1685
1686        7. a NUL (only exists if renamed/copied);
1687
1688        8. pathname in postimage (only exists if renamed/copied);
1689
1690        9. a NUL.
1691
1692       The extra NUL before the preimage path in renamed case is to allow
1693       scripts that read the output to tell if the current record being read
1694       is a single-path record or a rename/copy record without reading ahead.
1695       After reading added and deleted lines, reading up to NUL would yield
1696       the pathname, but if that is NUL, the record will show two paths.
1697

GIT

1699       Part of the git(1) suite
1700
1701
1702
1703Git 2.30.2                        2021-03-08                  GIT-DIFF-TREE(1)
Impressum