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           zebra
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 or
241               color.diff.{old,new}MovedAlternative. The change between the
242               two colors indicates that a new block was detected.
243
244           dimmed_zebra
245               Similar to zebra, but additional dimming of uninteresting parts
246               of moved code is performed. The bordering lines of two adjacent
247               blocks are considered interesting, the rest is uninteresting.
248
249       --word-diff[=<mode>]
250           Show a word diff, using the <mode> to delimit changed words. By
251           default, words are delimited by whitespace; see --word-diff-regex
252           below. The <mode> defaults to plain, and must be one of:
253
254           color
255               Highlight changed words using only colors. Implies --color.
256
257           plain
258               Show words as [-removed-] and {+added+}. Makes no attempts to
259               escape the delimiters if they appear in the input, so the
260               output may be ambiguous.
261
262           porcelain
263               Use a special line-based format intended for script
264               consumption. Added/removed/unchanged runs are printed in the
265               usual unified diff format, starting with a +/-/` ` character at
266               the beginning of the line and extending to the end of the line.
267               Newlines in the input are represented by a tilde ~ on a line of
268               its own.
269
270           none
271               Disable word diff again.
272
273           Note that despite the name of the first mode, color is used to
274           highlight the changed parts in all modes if enabled.
275
276       --word-diff-regex=<regex>
277           Use <regex> to decide what a word is, instead of considering runs
278           of non-whitespace to be a word. Also implies --word-diff unless it
279           was already enabled.
280
281           Every non-overlapping match of the <regex> is considered a word.
282           Anything between these matches is considered whitespace and
283           ignored(!) for the purposes of finding differences. You may want to
284           append |[^[:space:]] to your regular expression to make sure that
285           it matches all non-whitespace characters. A match that contains a
286           newline is silently truncated(!) at the newline.
287
288           For example, --word-diff-regex=.  will treat each character as a
289           word and, correspondingly, show differences character by character.
290
291           The regex can also be set via a diff driver or configuration
292           option, see gitattributes(5) or git-config(1). Giving it explicitly
293           overrides any diff driver or configuration setting. Diff drivers
294           override configuration settings.
295
296       --color-words[=<regex>]
297           Equivalent to --word-diff=color plus (if a regex was specified)
298           --word-diff-regex=<regex>.
299
300       --no-renames
301           Turn off rename detection, even when the configuration file gives
302           the default to do so.
303
304       --check
305           Warn if changes introduce conflict markers or whitespace errors.
306           What are considered whitespace errors is controlled by
307           core.whitespace configuration. By default, trailing whitespaces
308           (including lines that consist solely of whitespaces) and a space
309           character that is immediately followed by a tab character inside
310           the initial indent of the line are considered whitespace errors.
311           Exits with non-zero status if problems are found. Not compatible
312           with --exit-code.
313
314       --ws-error-highlight=<kind>
315           Highlight whitespace errors in the context, old or new lines of the
316           diff. Multiple values are separated by comma, none resets previous
317           values, default reset the list to new and all is a shorthand for
318           old,new,context. When this option is not given, and the
319           configuration variable diff.wsErrorHighlight is not set, only
320           whitespace errors in new lines are highlighted. The whitespace
321           errors are colored with color.diff.whitespace.
322
323       --full-index
324           Instead of the first handful of characters, show the full pre- and
325           post-image blob object names on the "index" line when generating
326           patch format output.
327
328       --binary
329           In addition to --full-index, output a binary diff that can be
330           applied with git-apply.
331
332       --abbrev[=<n>]
333           Instead of showing the full 40-byte hexadecimal object name in
334           diff-raw format output and diff-tree header lines, show only a
335           partial prefix. This is independent of the --full-index option
336           above, which controls the diff-patch output format. Non default
337           number of digits can be specified with --abbrev=<n>.
338
339       -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
340           Break complete rewrite changes into pairs of delete and create.
341           This serves two purposes:
342
343           It affects the way a change that amounts to a total rewrite of a
344           file not as a series of deletion and insertion mixed together with
345           a very few lines that happen to match textually as the context, but
346           as a single deletion of everything old followed by a single
347           insertion of everything new, and the number m controls this aspect
348           of the -B option (defaults to 60%).  -B/70% specifies that less
349           than 30% of the original should remain in the result for Git to
350           consider it a total rewrite (i.e. otherwise the resulting patch
351           will be a series of deletion and insertion mixed together with
352           context lines).
353
354           When used with -M, a totally-rewritten file is also considered as
355           the source of a rename (usually -M only considers a file that
356           disappeared as the source of a rename), and the number n controls
357           this aspect of the -B option (defaults to 50%).  -B20% specifies
358           that a change with addition and deletion compared to 20% or more of
359           the file’s size are eligible for being picked up as a possible
360           source of a rename to another file.
361
362       -M[<n>], --find-renames[=<n>]
363           Detect renames. If n is specified, it is a threshold on the
364           similarity index (i.e. amount of addition/deletions compared to the
365           file’s size). For example, -M90% means Git should consider a
366           delete/add pair to be a rename if more than 90% of the file hasn’t
367           changed. Without a % sign, the number is to be read as a fraction,
368           with a decimal point before it. I.e., -M5 becomes 0.5, and is thus
369           the same as -M50%. Similarly, -M05 is the same as -M5%. To limit
370           detection to exact renames, use -M100%. The default similarity
371           index is 50%.
372
373       -C[<n>], --find-copies[=<n>]
374           Detect copies as well as renames. See also --find-copies-harder. If
375           n is specified, it has the same meaning as for -M<n>.
376
377       --find-copies-harder
378           For performance reasons, by default, -C option finds copies only if
379           the original file of the copy was modified in the same changeset.
380           This flag makes the command inspect unmodified files as candidates
381           for the source of copy. This is a very expensive operation for
382           large projects, so use it with caution. Giving more than one -C
383           option has the same effect.
384
385       -D, --irreversible-delete
386           Omit the preimage for deletes, i.e. print only the header but not
387           the diff between the preimage and /dev/null. The resulting patch is
388           not meant to be applied with patch or git apply; this is solely for
389           people who want to just concentrate on reviewing the text after the
390           change. In addition, the output obviously lacks enough information
391           to apply such a patch in reverse, even manually, hence the name of
392           the option.
393
394           When used together with -B, omit also the preimage in the deletion
395           part of a delete/create pair.
396
397       -l<num>
398           The -M and -C options require O(n^2) processing time where n is the
399           number of potential rename/copy targets. This option prevents
400           rename/copy detection from running if the number of rename/copy
401           targets exceeds the specified number.
402
403       --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
404           Select only files that are Added (A), Copied (C), Deleted (D),
405           Modified (M), Renamed (R), have their type (i.e. regular file,
406           symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
407           (X), or have had their pairing Broken (B). Any combination of the
408           filter characters (including none) can be used. When *
409           (All-or-none) is added to the combination, all paths are selected
410           if there is any file that matches other criteria in the comparison;
411           if there is no file that matches other criteria, nothing is
412           selected.
413
414           Also, these upper-case letters can be downcased to exclude. E.g.
415           --diff-filter=ad excludes added and deleted paths.
416
417           Note that not all diffs can feature all types. For instance, diffs
418           from the index to the working tree can never have Added entries
419           (because the set of paths included in the diff is limited by what
420           is in the index). Similarly, copied and renamed entries cannot
421           appear if detection for those types is disabled.
422
423       -S<string>
424           Look for differences that change the number of occurrences of the
425           specified string (i.e. addition/deletion) in a file. Intended for
426           the scripter’s use.
427
428           It is useful when you’re looking for an exact block of code (like a
429           struct), and want to know the history of that block since it first
430           came into being: use the feature iteratively to feed the
431           interesting block in the preimage back into -S, and keep going
432           until you get the very first version of the block.
433
434       -G<regex>
435           Look for differences whose patch text contains added/removed lines
436           that match <regex>.
437
438           To illustrate the difference between -S<regex> --pickaxe-regex and
439           -G<regex>, consider a commit with the following diff in the same
440           file:
441
442               +    return !regexec(regexp, two->ptr, 1, &regmatch, 0);
443               ...
444               -    hit = !regexec(regexp, mf2.ptr, 1, &regmatch, 0);
445
446           While git log -G"regexec\(regexp" will show this commit, git log
447           -S"regexec\(regexp" --pickaxe-regex will not (because the number of
448           occurrences of that string did not change).
449
450           See the pickaxe entry in gitdiffcore(7) for more information.
451
452       --find-object=<object-id>
453           Look for differences that change the number of occurrences of the
454           specified object. Similar to -S, just the argument is different in
455           that it doesn’t search for a specific string but for a specific
456           object id.
457
458           The object can be a blob or a submodule commit. It implies the -t
459           option in git-log to also find trees.
460
461       --pickaxe-all
462           When -S or -G finds a change, show all the changes in that
463           changeset, not just the files that contain the change in <string>.
464
465       --pickaxe-regex
466           Treat the <string> given to -S as an extended POSIX regular
467           expression to match.
468
469       -O<orderfile>
470           Control the order in which files appear in the output. This
471           overrides the diff.orderFile configuration variable (see git-
472           config(1)). To cancel diff.orderFile, use -O/dev/null.
473
474           The output order is determined by the order of glob patterns in
475           <orderfile>. All files with pathnames that match the first pattern
476           are output first, all files with pathnames that match the second
477           pattern (but not the first) are output next, and so on. All files
478           with pathnames that do not match any pattern are output last, as if
479           there was an implicit match-all pattern at the end of the file. If
480           multiple pathnames have the same rank (they match the same pattern
481           but no earlier patterns), their output order relative to each other
482           is the normal order.
483
484           <orderfile> is parsed as follows:
485
486           ·   Blank lines are ignored, so they can be used as separators for
487               readability.
488
489           ·   Lines starting with a hash ("#") are ignored, so they can be
490               used for comments. Add a backslash ("\") to the beginning of
491               the pattern if it starts with a hash.
492
493           ·   Each other line contains a single pattern.
494
495           Patterns have the same syntax and semantics as patterns used for
496           fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
497           matches a pattern if removing any number of the final pathname
498           components matches the pattern. For example, the pattern "foo*bar"
499           matches "fooasdfbar" and "foo/bar/baz/asdf" but not "foobarx".
500
501       -R
502           Swap two inputs; that is, show differences from index or on-disk
503           file to tree contents.
504
505       --relative[=<path>]
506           When run from a subdirectory of the project, it can be told to
507           exclude changes outside the directory and show pathnames relative
508           to it with this option. When you are not in a subdirectory (e.g. in
509           a bare repository), you can name which subdirectory to make the
510           output relative to by giving a <path> as an argument.
511
512       -a, --text
513           Treat all files as text.
514
515       --ignore-cr-at-eol
516           Ignore carriage-return at the end of line when doing a comparison.
517
518       --ignore-space-at-eol
519           Ignore changes in whitespace at EOL.
520
521       -b, --ignore-space-change
522           Ignore changes in amount of whitespace. This ignores whitespace at
523           line end, and considers all other sequences of one or more
524           whitespace characters to be equivalent.
525
526       -w, --ignore-all-space
527           Ignore whitespace when comparing lines. This ignores differences
528           even if one line has whitespace where the other line has none.
529
530       --ignore-blank-lines
531           Ignore changes whose lines are all blank.
532
533       --inter-hunk-context=<lines>
534           Show the context between diff hunks, up to the specified number of
535           lines, thereby fusing hunks that are close to each other. Defaults
536           to diff.interHunkContext or 0 if the config option is unset.
537
538       -W, --function-context
539           Show whole surrounding functions of changes.
540
541       --exit-code
542           Make the program exit with codes similar to diff(1). That is, it
543           exits with 1 if there were differences and 0 means no differences.
544
545       --quiet
546           Disable all output of the program. Implies --exit-code.
547
548       --ext-diff
549           Allow an external diff helper to be executed. If you set an
550           external diff driver with gitattributes(5), you need to use this
551           option with git-log(1) and friends.
552
553       --no-ext-diff
554           Disallow external diff drivers.
555
556       --textconv, --no-textconv
557           Allow (or disallow) external text conversion filters to be run when
558           comparing binary files. See gitattributes(5) for details. Because
559           textconv filters are typically a one-way conversion, the resulting
560           diff is suitable for human consumption, but cannot be applied. For
561           this reason, textconv filters are enabled by default only for git-
562           diff(1) and git-log(1), but not for git-format-patch(1) or diff
563           plumbing commands.
564
565       --ignore-submodules[=<when>]
566           Ignore changes to submodules in the diff generation. <when> can be
567           either "none", "untracked", "dirty" or "all", which is the default.
568           Using "none" will consider the submodule modified when it either
569           contains untracked or modified files or its HEAD differs from the
570           commit recorded in the superproject and can be used to override any
571           settings of the ignore option in git-config(1) or gitmodules(5).
572           When "untracked" is used submodules are not considered dirty when
573           they only contain untracked content (but they are still scanned for
574           modified content). Using "dirty" ignores all changes to the work
575           tree of submodules, only changes to the commits stored in the
576           superproject are shown (this was the behavior until 1.7.0). Using
577           "all" hides all changes to submodules.
578
579       --src-prefix=<prefix>
580           Show the given source prefix instead of "a/".
581
582       --dst-prefix=<prefix>
583           Show the given destination prefix instead of "b/".
584
585       --no-prefix
586           Do not show any source or destination prefix.
587
588       --line-prefix=<prefix>
589           Prepend an additional prefix to every line of output.
590
591       --ita-invisible-in-index
592           By default entries added by "git add -N" appear as an existing
593           empty file in "git diff" and a new file in "git diff --cached".
594           This option makes the entry appear as a new file in "git diff" and
595           non-existent in "git diff --cached". This option could be reverted
596           with --ita-visible-in-index. Both options are experimental and
597           could be removed in future.
598
599       For more detailed explanation on these common options, see also
600       gitdiffcore(7).
601
602       <tree-ish>
603           The id of a tree object.
604
605       <path>...
606           If provided, the results are limited to a subset of files matching
607           one of these prefix strings. i.e., file matches
608           /^<pattern1>|<pattern2>|.../ Note that this parameter does not
609           provide any wildcard or regexp features.
610
611       -r
612           recurse into sub-trees
613
614       -t
615           show tree entry itself as well as subtrees. Implies -r.
616
617       --root
618           When --root is specified the initial commit will be shown as a big
619           creation event. This is equivalent to a diff against the NULL tree.
620
621       --stdin
622           When --stdin is specified, the command does not take <tree-ish>
623           arguments from the command line. Instead, it reads lines containing
624           either two <tree>, one <commit>, or a list of <commit> from its
625           standard input. (Use a single space as separator.)
626
627           When two trees are given, it compares the first tree with the
628           second. When a single commit is given, it compares the commit with
629           its parents. The remaining commits, when given, are used as if they
630           are parents of the first commit.
631
632           When comparing two trees, the ID of both trees (separated by a
633           space and terminated by a newline) is printed before the
634           difference. When comparing commits, the ID of the first (or only)
635           commit, followed by a newline, is printed.
636
637           The following flags further affect the behavior when comparing
638           commits (but not trees).
639
640       -m
641           By default, git diff-tree --stdin does not show differences for
642           merge commits. With this flag, it shows differences to that commit
643           from all of its parents. See also -c.
644
645       -s
646           By default, git diff-tree --stdin shows differences, either in
647           machine-readable form (without -p) or in patch form (with -p). This
648           output can be suppressed. It is only useful with -v flag.
649
650       -v
651           This flag causes git diff-tree --stdin to also show the commit
652           message before the differences.
653
654       --pretty[=<format>], --format=<format>
655           Pretty-print the contents of the commit logs in a given format,
656           where <format> can be one of oneline, short, medium, full, fuller,
657           email, raw, format:<string> and tformat:<string>. When <format> is
658           none of the above, and has %placeholder in it, it acts as if
659           --pretty=tformat:<format> were given.
660
661           See the "PRETTY FORMATS" section for some additional details for
662           each format. When =<format> part is omitted, it defaults to medium.
663
664           Note: you can specify the default pretty format in the repository
665           configuration (see git-config(1)).
666
667       --abbrev-commit
668           Instead of showing the full 40-byte hexadecimal commit object name,
669           show only a partial prefix. Non default number of digits can be
670           specified with "--abbrev=<n>" (which also modifies diff output, if
671           it is displayed).
672
673           This should make "--pretty=oneline" a whole lot more readable for
674           people using 80-column terminals.
675
676       --no-abbrev-commit
677           Show the full 40-byte hexadecimal commit object name. This negates
678           --abbrev-commit and those options which imply it such as
679           "--oneline". It also overrides the log.abbrevCommit variable.
680
681       --oneline
682           This is a shorthand for "--pretty=oneline --abbrev-commit" used
683           together.
684
685       --encoding=<encoding>
686           The commit objects record the encoding used for the log message in
687           their encoding header; this option can be used to tell the command
688           to re-code the commit log message in the encoding preferred by the
689           user. For non plumbing commands this defaults to UTF-8. Note that
690           if an object claims to be encoded in X and we are outputting in X,
691           we will output the object verbatim; this means that invalid
692           sequences in the original commit may be copied to the output.
693
694       --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
695           Perform a tab expansion (replace each tab with enough spaces to
696           fill to the next display column that is multiple of <n>) in the log
697           message before showing it in the output.  --expand-tabs is a
698           short-hand for --expand-tabs=8, and --no-expand-tabs is a
699           short-hand for --expand-tabs=0, which disables tab expansion.
700
701           By default, tabs are expanded in pretty formats that indent the log
702           message by 4 spaces (i.e.  medium, which is the default, full, and
703           fuller).
704
705       --notes[=<treeish>]
706           Show the notes (see git-notes(1)) that annotate the commit, when
707           showing the commit log message. This is the default for git log,
708           git show and git whatchanged commands when there is no --pretty,
709           --format, or --oneline option given on the command line.
710
711           By default, the notes shown are from the notes refs listed in the
712           core.notesRef and notes.displayRef variables (or corresponding
713           environment overrides). See git-config(1) for more details.
714
715           With an optional <treeish> argument, use the treeish to find the
716           notes to display. The treeish can specify the full refname when it
717           begins with refs/notes/; when it begins with notes/, refs/ and
718           otherwise refs/notes/ is prefixed to form a full name of the ref.
719
720           Multiple --notes options can be combined to control which notes are
721           being displayed. Examples: "--notes=foo" will show only notes from
722           "refs/notes/foo"; "--notes=foo --notes" will show both notes from
723           "refs/notes/foo" and from the default notes ref(s).
724
725       --no-notes
726           Do not show notes. This negates the above --notes option, by
727           resetting the list of notes refs from which notes are shown.
728           Options are parsed in the order given on the command line, so e.g.
729           "--notes --notes=foo --no-notes --notes=bar" will only show notes
730           from "refs/notes/bar".
731
732       --show-notes[=<treeish>], --[no-]standard-notes
733           These options are deprecated. Use the above --notes/--no-notes
734           options instead.
735
736       --show-signature
737           Check the validity of a signed commit object by passing the
738           signature to gpg --verify and show the output.
739
740       --no-commit-id
741           git diff-tree outputs a line with the commit ID when applicable.
742           This flag suppressed the commit ID output.
743
744       -c
745           This flag changes the way a merge commit is displayed (which means
746           it is useful only when the command is given one <tree-ish>, or
747           --stdin). It shows the differences from each of the parents to the
748           merge result simultaneously instead of showing pairwise diff
749           between a parent and the result one at a time (which is what the -m
750           option does). Furthermore, it lists only files which were modified
751           from all parents.
752
753       --cc
754           This flag changes the way a merge commit patch is displayed, in a
755           similar way to the -c option. It implies the -c and -p options and
756           further compresses the patch output by omitting uninteresting hunks
757           whose the contents in the parents have only two variants and the
758           merge result picks one of them without modification. When all hunks
759           are uninteresting, the commit itself and the commit log message is
760           not shown, just like in any other "empty diff" case.
761
762       --always
763           Show the commit itself and the commit log message even if the diff
764           itself is empty.
765

PRETTY FORMATS

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

LIMITING OUTPUT

1075       If you’re only interested in differences in a subset of files, for
1076       example some architecture-specific files, you might do:
1077
1078           git diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64
1079
1080       and it will only show you what changed in those two directories.
1081
1082       Or if you are searching for what changed in just kernel/sched.c, just
1083       do
1084
1085           git diff-tree -r <tree-ish> <tree-ish> kernel/sched.c
1086
1087       and it will ignore all differences to other files.
1088
1089       The pattern is always the prefix, and is matched exactly. There are no
1090       wildcards. Even stricter, it has to match a complete path component.
1091       I.e. "foo" does not pick up foobar.h. "foo" does match foo/bar.h so it
1092       can be used to name subdirectories.
1093
1094       An example of normal usage is:
1095
1096           torvalds@ppc970:~/git> git diff-tree --abbrev 5319e4
1097           :100664 100664 ac348b... a01513...    git-fsck-objects.c
1098
1099       which tells you that the last commit changed just one file (it’s from
1100       this one:
1101
1102           commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
1103           tree 5319e4d609cdd282069cc4dce33c1db559539b03
1104           parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
1105           author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005
1106           committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005
1107
1108           Make "git-fsck-objects" print out all the root commits it finds.
1109
1110           Once I do the reference tracking, I'll also make it print out all the
1111           HEAD commits it finds, which is even more interesting.
1112
1113
1114       in case you care).
1115

RAW OUTPUT FORMAT

1117       The raw output format from "git-diff-index", "git-diff-tree",
1118       "git-diff-files" and "git diff --raw" are very similar.
1119
1120       These commands all compare two sets of things; what is compared
1121       differs:
1122
1123       git-diff-index <tree-ish>
1124           compares the <tree-ish> and the files on the filesystem.
1125
1126       git-diff-index --cached <tree-ish>
1127           compares the <tree-ish> and the index.
1128
1129       git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
1130           compares the trees named by the two arguments.
1131
1132       git-diff-files [<pattern>...]
1133           compares the index and the files on the filesystem.
1134
1135       The "git-diff-tree" command begins its output by printing the hash of
1136       what is being compared. After that, all the commands print one output
1137       line per changed file.
1138
1139       An output line is formatted this way:
1140
1141           in-place edit  :100644 100644 bcd1234... 0123456... M file0
1142           copy-edit      :100644 100644 abcd123... 1234567... C68 file1 file2
1143           rename-edit    :100644 100644 abcd123... 1234567... R86 file1 file3
1144           create         :000000 100644 0000000... 1234567... A file4
1145           delete         :100644 000000 1234567... 0000000... D file5
1146           unmerged       :000000 000000 0000000... 0000000... U file6
1147
1148
1149       That is, from the left to the right:
1150
1151        1. a colon.
1152
1153        2. mode for "src"; 000000 if creation or unmerged.
1154
1155        3. a space.
1156
1157        4. mode for "dst"; 000000 if deletion or unmerged.
1158
1159        5. a space.
1160
1161        6. sha1 for "src"; 0{40} if creation or unmerged.
1162
1163        7. a space.
1164
1165        8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1166
1167        9. a space.
1168
1169       10. status, followed by optional "score" number.
1170
1171       11. a tab or a NUL when -z option is used.
1172
1173       12. path for "src"
1174
1175       13. a tab or a NUL when -z option is used; only exists for C or R.
1176
1177       14. path for "dst"; only exists for C or R.
1178
1179       15. an LF or a NUL when -z option is used, to terminate the record.
1180
1181       Possible status letters are:
1182
1183       ·   A: addition of a file
1184
1185       ·   C: copy of a file into a new one
1186
1187       ·   D: deletion of a file
1188
1189       ·   M: modification of the contents or mode of a file
1190
1191       ·   R: renaming of a file
1192
1193       ·   T: change in the type of the file
1194
1195       ·   U: file is unmerged (you must complete the merge before it can be
1196           committed)
1197
1198       ·   X: "unknown" change type (most probably a bug, please report it)
1199
1200       Status letters C and R are always followed by a score (denoting the
1201       percentage of similarity between the source and target of the move or
1202       copy). Status letter M may be followed by a score (denoting the
1203       percentage of dissimilarity) for file rewrites.
1204
1205       <sha1> is shown as all 0’s if a file is new on the filesystem and it is
1206       out of sync with the index.
1207
1208       Example:
1209
1210           :100644 100644 5be4a4...... 000000...... M file.c
1211
1212
1213       Without the -z option, pathnames with "unusual" characters are quoted
1214       as explained for the configuration variable core.quotePath (see git-
1215       config(1)). Using -z the filename is output verbatim and the line is
1216       terminated by a NUL byte.
1217

DIFF FORMAT FOR MERGES

1219       "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
1220       --cc option to generate diff output also for merge commits. The output
1221       differs from the format described above in the following way:
1222
1223        1. there is a colon for each parent
1224
1225        2. there are more "src" modes and "src" sha1
1226
1227        3. status is concatenated status characters for each parent
1228
1229        4. no optional "score" number
1230
1231        5. single path, only for "dst"
1232
1233       Example:
1234
1235           ::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c
1236
1237
1238       Note that combined diff lists only files which were modified from all
1239       parents.
1240

GENERATING PATCHES WITH -P

1242       When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1243       with a -p option, "git diff" without the --raw option, or "git log"
1244       with the "-p" option, they do not produce the output described above;
1245       instead they produce a patch file. You can customize the creation of
1246       such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
1247       environment variables.
1248
1249       What the -p option produces is slightly different from the traditional
1250       diff format:
1251
1252        1. It is preceded with a "git diff" header that looks like this:
1253
1254               diff --git a/file1 b/file2
1255
1256           The a/ and b/ filenames are the same unless rename/copy is
1257           involved. Especially, even for a creation or a deletion, /dev/null
1258           is not used in place of the a/ or b/ filenames.
1259
1260           When rename/copy is involved, file1 and file2 show the name of the
1261           source file of the rename/copy and the name of the file that
1262           rename/copy produces, respectively.
1263
1264        2. It is followed by one or more extended header lines:
1265
1266               old mode <mode>
1267               new mode <mode>
1268               deleted file mode <mode>
1269               new file mode <mode>
1270               copy from <path>
1271               copy to <path>
1272               rename from <path>
1273               rename to <path>
1274               similarity index <number>
1275               dissimilarity index <number>
1276               index <hash>..<hash> <mode>
1277
1278           File modes are printed as 6-digit octal numbers including the file
1279           type and file permission bits.
1280
1281           Path names in extended headers do not include the a/ and b/
1282           prefixes.
1283
1284           The similarity index is the percentage of unchanged lines, and the
1285           dissimilarity index is the percentage of changed lines. It is a
1286           rounded down integer, followed by a percent sign. The similarity
1287           index value of 100% is thus reserved for two equal files, while
1288           100% dissimilarity means that no line from the old file made it
1289           into the new one.
1290
1291           The index line includes the SHA-1 checksum before and after the
1292           change. The <mode> is included if the file mode does not change;
1293           otherwise, separate lines indicate the old and the new mode.
1294
1295        3. Pathnames with "unusual" characters are quoted as explained for the
1296           configuration variable core.quotePath (see git-config(1)).
1297
1298        4. All the file1 files in the output refer to files before the commit,
1299           and all the file2 files refer to files after the commit. It is
1300           incorrect to apply each change to each file sequentially. For
1301           example, this patch will swap a and b:
1302
1303               diff --git a/a b/b
1304               rename from a
1305               rename to b
1306               diff --git a/b b/a
1307               rename from b
1308               rename to a
1309

COMBINED DIFF FORMAT

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

OTHER DIFF FORMATS

1417       The --summary option describes newly added, deleted, renamed and copied
1418       files. The --stat option adds diffstat(1) graph to the output. These
1419       options can be combined with other options, such as -p, and are meant
1420       for human consumption.
1421
1422       When showing a change that involves a rename or a copy, --stat output
1423       formats the pathnames compactly by combining common prefix and suffix
1424       of the pathnames. For example, a change that moves arch/i386/Makefile
1425       to arch/x86/Makefile while modifying 4 lines will be shown like this:
1426
1427           arch/{i386 => x86}/Makefile    |   4 +--
1428
1429
1430       The --numstat option gives the diffstat(1) information but is designed
1431       for easier machine consumption. An entry in --numstat output looks like
1432       this:
1433
1434           1       2       README
1435           3       1       arch/{i386 => x86}/Makefile
1436
1437
1438       That is, from left to right:
1439
1440        1. the number of added lines;
1441
1442        2. a tab;
1443
1444        3. the number of deleted lines;
1445
1446        4. a tab;
1447
1448        5. pathname (possibly with rename/copy information);
1449
1450        6. a newline.
1451
1452       When -z output option is in effect, the output is formatted this way:
1453
1454           1       2       README NUL
1455           3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
1456
1457
1458       That is:
1459
1460        1. the number of added lines;
1461
1462        2. a tab;
1463
1464        3. the number of deleted lines;
1465
1466        4. a tab;
1467
1468        5. a NUL (only exists if renamed/copied);
1469
1470        6. pathname in preimage;
1471
1472        7. a NUL (only exists if renamed/copied);
1473
1474        8. pathname in postimage (only exists if renamed/copied);
1475
1476        9. a NUL.
1477
1478       The extra NUL before the preimage path in renamed case is to allow
1479       scripts that read the output to tell if the current record being read
1480       is a single-path record or a rename/copy record without reading ahead.
1481       After reading added and deleted lines, reading up to NUL would yield
1482       the pathname, but if that is NUL, the record will show two paths.
1483

GIT

1485       Part of the git(1) suite
1486
1487
1488
1489Git 2.18.1                        05/14/2019                  GIT-DIFF-TREE(1)
Impressum