1GIT-DIFF-TREE(1) Git Manual GIT-DIFF-TREE(1)
2
3
4
6 git-diff-tree - Compares the content and mode of blobs found via two
7 tree objects
8
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
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
25 -p, -u, --patch
26 Generate patch (see section on generating patches).
27
28 -s, --no-patch
29 Suppress diff output. Useful for commands like git show that show
30 the patch by default, or to cancel the effect of --patch.
31
32 -U<n>, --unified=<n>
33 Generate diffs with <n> lines of context instead of the usual
34 three. Implies -p.
35
36 --raw
37 Generate the diff in raw format. This is the default.
38
39 --patch-with-raw
40 Synonym for -p --raw.
41
42 --indent-heuristic
43 Enable the heuristic that shifts diff hunk boundaries to make
44 patches easier to read. This is the default.
45
46 --no-indent-heuristic
47 Disable the indent heuristic.
48
49 --minimal
50 Spend extra time to make sure the smallest possible diff is
51 produced.
52
53 --patience
54 Generate a diff using the "patience diff" algorithm.
55
56 --histogram
57 Generate a diff using the "histogram diff" algorithm.
58
59 --anchored=<text>
60 Generate a diff using the "anchored diff" algorithm.
61
62 This option may be specified more than once.
63
64 If a line exists in both the source and destination, exists only
65 once, and starts with this text, this algorithm attempts to prevent
66 it from appearing as a deletion or addition in the output. It uses
67 the "patience diff" algorithm internally.
68
69 --diff-algorithm={patience|minimal|histogram|myers}
70 Choose a diff algorithm. The variants are as follows:
71
72 default, myers
73 The basic greedy diff algorithm. Currently, this is the
74 default.
75
76 minimal
77 Spend extra time to make sure the smallest possible diff is
78 produced.
79
80 patience
81 Use "patience diff" algorithm when generating patches.
82
83 histogram
84 This algorithm extends the patience algorithm to "support
85 low-occurrence common elements".
86
87 For instance, if you configured the diff.algorithm variable to a
88 non-default value and want to use the default one, then you have to
89 use --diff-algorithm=default option.
90
91 --stat[=<width>[,<name-width>[,<count>]]]
92 Generate a diffstat. By default, as much space as necessary will be
93 used for the filename part, and the rest for the graph part.
94 Maximum width defaults to terminal width, or 80 columns if not
95 connected to a terminal, and can be overridden by <width>. The
96 width of the filename part can be limited by giving another width
97 <name-width> after a comma. The width of the graph part can be
98 limited by using --stat-graph-width=<width> (affects all commands
99 generating a stat graph) or by setting diff.statGraphWidth=<width>
100 (does not affect git format-patch). By giving a third parameter
101 <count>, you can limit the output to the first <count> lines,
102 followed by ... if there are more.
103
104 These parameters can also be set individually with
105 --stat-width=<width>, --stat-name-width=<name-width> and
106 --stat-count=<count>.
107
108 --compact-summary
109 Output a condensed summary of extended header information such as
110 file creations or deletions ("new" or "gone", optionally "+l" if
111 it’s a symlink) and mode changes ("+x" or "-x" for adding or
112 removing executable bit respectively) in diffstat. The information
113 is put between the filename part and the graph part. Implies
114 --stat.
115
116 --numstat
117 Similar to --stat, but shows number of added and deleted lines in
118 decimal notation and pathname without abbreviation, to make it more
119 machine friendly. For binary files, outputs two - instead of saying
120 0 0.
121
122 --shortstat
123 Output only the last line of the --stat format containing total
124 number of modified files, as well as number of added and deleted
125 lines.
126
127 --dirstat[=<param1,param2,...>]
128 Output the distribution of relative amount of changes for each
129 sub-directory. The behavior of --dirstat can be customized by
130 passing it a comma separated list of parameters. The defaults are
131 controlled by the diff.dirstat configuration variable (see git-
132 config(1)). The following parameters are available:
133
134 changes
135 Compute the dirstat numbers by counting the lines that have
136 been removed from the source, or added to the destination. This
137 ignores the amount of pure code movements within a file. In
138 other words, rearranging lines in a file is not counted as much
139 as other changes. This is the default behavior when no
140 parameter is given.
141
142 lines
143 Compute the dirstat numbers by doing the regular line-based
144 diff analysis, and summing the removed/added line counts. (For
145 binary files, count 64-byte chunks instead, since binary files
146 have no natural concept of lines). This is a more expensive
147 --dirstat behavior than the changes behavior, but it does count
148 rearranged lines within a file as much as other changes. The
149 resulting output is consistent with what you get from the other
150 --*stat options.
151
152 files
153 Compute the dirstat numbers by counting the number of files
154 changed. Each changed file counts equally in the dirstat
155 analysis. This is the computationally cheapest --dirstat
156 behavior, since it does not have to look at the file contents
157 at all.
158
159 cumulative
160 Count changes in a child directory for the parent directory as
161 well. Note that when using cumulative, the sum of the
162 percentages reported may exceed 100%. The default
163 (non-cumulative) behavior can be specified with the
164 noncumulative parameter.
165
166 <limit>
167 An integer parameter specifies a cut-off percent (3% by
168 default). Directories contributing less than this percentage of
169 the changes are not shown in the output.
170
171 Example: The following will count changed files, while ignoring
172 directories with less than 10% of the total amount of changed
173 files, and accumulating child directory counts in the parent
174 directories: --dirstat=files,10,cumulative.
175
176 --summary
177 Output a condensed summary of extended header information such as
178 creations, renames and mode changes.
179
180 --patch-with-stat
181 Synonym for -p --stat.
182
183 -z
184 When --raw, --numstat, --name-only or --name-status has been given,
185 do not munge pathnames and use NULs as output field terminators.
186
187 Without this option, pathnames with "unusual" characters are quoted
188 as explained for the configuration variable core.quotePath (see
189 git-config(1)).
190
191 --name-only
192 Show only names of changed files.
193
194 --name-status
195 Show only names and status of changed files. See the description of
196 the --diff-filter option on what the status letters mean.
197
198 --submodule[=<format>]
199 Specify how differences in submodules are shown. When specifying
200 --submodule=short the short format is used. This format just shows
201 the names of the commits at the beginning and end of the range.
202 When --submodule or --submodule=log is specified, the log format is
203 used. This format lists the commits in the range like git-
204 submodule(1) summary does. When --submodule=diff is specified, the
205 diff format is used. This format shows an inline diff of the
206 changes in the submodule contents between the commit range.
207 Defaults to diff.submodule or the short format if the config option
208 is unset.
209
210 --color[=<when>]
211 Show colored diff. --color (i.e. without =<when>) is the same as
212 --color=always. <when> can be one of always, never, or auto.
213
214 --no-color
215 Turn off colored diff. It is the same as --color=never.
216
217 --color-moved[=<mode>]
218 Moved lines of code are colored differently. The <mode> defaults to
219 no if the option is not given and to zebra if the option with no
220 mode is given. The mode must be one of:
221
222 no
223 Moved lines are not highlighted.
224
225 default
226 Is a synonym for zebra. This may change to a more sensible mode
227 in the future.
228
229 plain
230 Any line that is added in one location and was removed in
231 another location will be colored with color.diff.newMoved.
232 Similarly color.diff.oldMoved will be used for removed lines
233 that are added somewhere else in the diff. This mode picks up
234 any moved line, but it is not very useful in a review to
235 determine if a block of code was moved without permutation.
236
237 blocks
238 Blocks of moved text of at least 20 alphanumeric characters are
239 detected greedily. The detected blocks are painted using either
240 the color.diff.{old,new}Moved color. Adjacent blocks cannot be
241 told apart.
242
243 zebra
244 Blocks of moved text are detected as in blocks mode. The blocks
245 are painted using either the color.diff.{old,new}Moved color or
246 color.diff.{old,new}MovedAlternative. The change between the
247 two colors indicates that a new block was detected.
248
249 dimmed-zebra
250 Similar to zebra, but additional dimming of uninteresting parts
251 of moved code is performed. The bordering lines of two adjacent
252 blocks are considered interesting, the rest is uninteresting.
253 dimmed_zebra is a deprecated synonym.
254
255 --no-color-moved
256 Turn off move detection. This can be used to override configuration
257 settings. It is the same as --color-moved=no.
258
259 --color-moved-ws=<modes>
260 This configures how whitespace is ignored when performing the move
261 detection for --color-moved. These modes can be given as a comma
262 separated list:
263
264 no
265 Do not ignore whitespace when performing move detection.
266
267 ignore-space-at-eol
268 Ignore changes in whitespace at EOL.
269
270 ignore-space-change
271 Ignore changes in amount of whitespace. This ignores whitespace
272 at line end, and considers all other sequences of one or more
273 whitespace characters to be equivalent.
274
275 ignore-all-space
276 Ignore whitespace when comparing lines. This ignores
277 differences even if one line has whitespace where the other
278 line has none.
279
280 allow-indentation-change
281 Initially ignore any whitespace in the move detection, then
282 group the moved code blocks only into a block if the change in
283 whitespace is the same per line. This is incompatible with the
284 other modes.
285
286 --no-color-moved-ws
287 Do not ignore whitespace when performing move detection. This can
288 be used to override configuration settings. It is the same as
289 --color-moved-ws=no.
290
291 --word-diff[=<mode>]
292 Show a word diff, using the <mode> to delimit changed words. By
293 default, words are delimited by whitespace; see --word-diff-regex
294 below. The <mode> defaults to plain, and must be one of:
295
296 color
297 Highlight changed words using only colors. Implies --color.
298
299 plain
300 Show words as [-removed-] and {+added+}. Makes no attempts to
301 escape the delimiters if they appear in the input, so the
302 output may be ambiguous.
303
304 porcelain
305 Use a special line-based format intended for script
306 consumption. Added/removed/unchanged runs are printed in the
307 usual unified diff format, starting with a +/-/` ` character at
308 the beginning of the line and extending to the end of the line.
309 Newlines in the input are represented by a tilde ~ on a line of
310 its own.
311
312 none
313 Disable word diff again.
314
315 Note that despite the name of the first mode, color is used to
316 highlight the changed parts in all modes if enabled.
317
318 --word-diff-regex=<regex>
319 Use <regex> to decide what a word is, instead of considering runs
320 of non-whitespace to be a word. Also implies --word-diff unless it
321 was already enabled.
322
323 Every non-overlapping match of the <regex> is considered a word.
324 Anything between these matches is considered whitespace and
325 ignored(!) for the purposes of finding differences. You may want to
326 append |[^[:space:]] to your regular expression to make sure that
327 it matches all non-whitespace characters. A match that contains a
328 newline is silently truncated(!) at the newline.
329
330 For example, --word-diff-regex=. will treat each character as a
331 word and, correspondingly, show differences character by character.
332
333 The regex can also be set via a diff driver or configuration
334 option, see gitattributes(5) or git-config(1). Giving it explicitly
335 overrides any diff driver or configuration setting. Diff drivers
336 override configuration settings.
337
338 --color-words[=<regex>]
339 Equivalent to --word-diff=color plus (if a regex was specified)
340 --word-diff-regex=<regex>.
341
342 --no-renames
343 Turn off rename detection, even when the configuration file gives
344 the default to do so.
345
346 --check
347 Warn if changes introduce conflict markers or whitespace errors.
348 What are considered whitespace errors is controlled by
349 core.whitespace configuration. By default, trailing whitespaces
350 (including lines that consist solely of whitespaces) and a space
351 character that is immediately followed by a tab character inside
352 the initial indent of the line are considered whitespace errors.
353 Exits with non-zero status if problems are found. Not compatible
354 with --exit-code.
355
356 --ws-error-highlight=<kind>
357 Highlight whitespace errors in the context, old or new lines of the
358 diff. Multiple values are separated by comma, none resets previous
359 values, default reset the list to new and all is a shorthand for
360 old,new,context. When this option is not given, and the
361 configuration variable diff.wsErrorHighlight is not set, only
362 whitespace errors in new lines are highlighted. The whitespace
363 errors are colored with color.diff.whitespace.
364
365 --full-index
366 Instead of the first handful of characters, show the full pre- and
367 post-image blob object names on the "index" line when generating
368 patch format output.
369
370 --binary
371 In addition to --full-index, output a binary diff that can be
372 applied with git-apply.
373
374 --abbrev[=<n>]
375 Instead of showing the full 40-byte hexadecimal object name in
376 diff-raw format output and diff-tree header lines, show only a
377 partial prefix. This is independent of the --full-index option
378 above, which controls the diff-patch output format. Non default
379 number of digits can be specified with --abbrev=<n>.
380
381 -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
382 Break complete rewrite changes into pairs of delete and create.
383 This serves two purposes:
384
385 It affects the way a change that amounts to a total rewrite of a
386 file not as a series of deletion and insertion mixed together with
387 a very few lines that happen to match textually as the context, but
388 as a single deletion of everything old followed by a single
389 insertion of everything new, and the number m controls this aspect
390 of the -B option (defaults to 60%). -B/70% specifies that less
391 than 30% of the original should remain in the result for Git to
392 consider it a total rewrite (i.e. otherwise the resulting patch
393 will be a series of deletion and insertion mixed together with
394 context lines).
395
396 When used with -M, a totally-rewritten file is also considered as
397 the source of a rename (usually -M only considers a file that
398 disappeared as the source of a rename), and the number n controls
399 this aspect of the -B option (defaults to 50%). -B20% specifies
400 that a change with addition and deletion compared to 20% or more of
401 the file’s size are eligible for being picked up as a possible
402 source of a rename to another file.
403
404 -M[<n>], --find-renames[=<n>]
405 Detect renames. If n is specified, it is a threshold on the
406 similarity index (i.e. amount of addition/deletions compared to the
407 file’s size). For example, -M90% means Git should consider a
408 delete/add pair to be a rename if more than 90% of the file hasn’t
409 changed. Without a % sign, the number is to be read as a fraction,
410 with a decimal point before it. I.e., -M5 becomes 0.5, and is thus
411 the same as -M50%. Similarly, -M05 is the same as -M5%. To limit
412 detection to exact renames, use -M100%. The default similarity
413 index is 50%.
414
415 -C[<n>], --find-copies[=<n>]
416 Detect copies as well as renames. See also --find-copies-harder. If
417 n is specified, it has the same meaning as for -M<n>.
418
419 --find-copies-harder
420 For performance reasons, by default, -C option finds copies only if
421 the original file of the copy was modified in the same changeset.
422 This flag makes the command inspect unmodified files as candidates
423 for the source of copy. This is a very expensive operation for
424 large projects, so use it with caution. Giving more than one -C
425 option has the same effect.
426
427 -D, --irreversible-delete
428 Omit the preimage for deletes, i.e. print only the header but not
429 the diff between the preimage and /dev/null. The resulting patch is
430 not meant to be applied with patch or git apply; this is solely for
431 people who want to just concentrate on reviewing the text after the
432 change. In addition, the output obviously lacks enough information
433 to apply such a patch in reverse, even manually, hence the name of
434 the option.
435
436 When used together with -B, omit also the preimage in the deletion
437 part of a delete/create pair.
438
439 -l<num>
440 The -M and -C options require O(n^2) processing time where n is the
441 number of potential rename/copy targets. This option prevents
442 rename/copy detection from running if the number of rename/copy
443 targets exceeds the specified number.
444
445 --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
446 Select only files that are Added (A), Copied (C), Deleted (D),
447 Modified (M), Renamed (R), have their type (i.e. regular file,
448 symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
449 (X), or have had their pairing Broken (B). Any combination of the
450 filter characters (including none) can be used. When *
451 (All-or-none) is added to the combination, all paths are selected
452 if there is any file that matches other criteria in the comparison;
453 if there is no file that matches other criteria, nothing is
454 selected.
455
456 Also, these upper-case letters can be downcased to exclude. E.g.
457 --diff-filter=ad excludes added and deleted paths.
458
459 Note that not all diffs can feature all types. For instance, diffs
460 from the index to the working tree can never have Added entries
461 (because the set of paths included in the diff is limited by what
462 is in the index). Similarly, copied and renamed entries cannot
463 appear if detection for those types is disabled.
464
465 -S<string>
466 Look for differences that change the number of occurrences of the
467 specified string (i.e. addition/deletion) in a file. Intended for
468 the scripter’s use.
469
470 It is useful when you’re looking for an exact block of code (like a
471 struct), and want to know the history of that block since it first
472 came into being: use the feature iteratively to feed the
473 interesting block in the preimage back into -S, and keep going
474 until you get the very first version of the block.
475
476 Binary files are searched as well.
477
478 -G<regex>
479 Look for differences whose patch text contains added/removed lines
480 that match <regex>.
481
482 To illustrate the difference between -S<regex> --pickaxe-regex and
483 -G<regex>, consider a commit with the following diff in the same
484 file:
485
486 + return !regexec(regexp, two->ptr, 1, ®match, 0);
487 ...
488 - hit = !regexec(regexp, mf2.ptr, 1, ®match, 0);
489
490 While git log -G"regexec\(regexp" will show this commit, git log
491 -S"regexec\(regexp" --pickaxe-regex will not (because the number of
492 occurrences of that string did not change).
493
494 Unless --text is supplied patches of binary files without a
495 textconv filter will be ignored.
496
497 See the pickaxe entry in gitdiffcore(7) for more information.
498
499 --find-object=<object-id>
500 Look for differences that change the number of occurrences of the
501 specified object. Similar to -S, just the argument is different in
502 that it doesn’t search for a specific string but for a specific
503 object id.
504
505 The object can be a blob or a submodule commit. It implies the -t
506 option in git-log to also find trees.
507
508 --pickaxe-all
509 When -S or -G finds a change, show all the changes in that
510 changeset, not just the files that contain the change in <string>.
511
512 --pickaxe-regex
513 Treat the <string> given to -S as an extended POSIX regular
514 expression to match.
515
516 -O<orderfile>
517 Control the order in which files appear in the output. This
518 overrides the diff.orderFile configuration variable (see git-
519 config(1)). To cancel diff.orderFile, use -O/dev/null.
520
521 The output order is determined by the order of glob patterns in
522 <orderfile>. All files with pathnames that match the first pattern
523 are output first, all files with pathnames that match the second
524 pattern (but not the first) are output next, and so on. All files
525 with pathnames that do not match any pattern are output last, as if
526 there was an implicit match-all pattern at the end of the file. If
527 multiple pathnames have the same rank (they match the same pattern
528 but no earlier patterns), their output order relative to each other
529 is the normal order.
530
531 <orderfile> is parsed as follows:
532
533 · Blank lines are ignored, so they can be used as separators for
534 readability.
535
536 · Lines starting with a hash ("#") are ignored, so they can be
537 used for comments. Add a backslash ("\") to the beginning of
538 the pattern if it starts with a hash.
539
540 · Each other line contains a single pattern.
541
542 Patterns have the same syntax and semantics as patterns used for
543 fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
544 matches a pattern if removing any number of the final pathname
545 components matches the pattern. For example, the pattern "foo*bar"
546 matches "fooasdfbar" and "foo/bar/baz/asdf" but not "foobarx".
547
548 -R
549 Swap two inputs; that is, show differences from index or on-disk
550 file to tree contents.
551
552 --relative[=<path>]
553 When run from a subdirectory of the project, it can be told to
554 exclude changes outside the directory and show pathnames relative
555 to it with this option. When you are not in a subdirectory (e.g. in
556 a bare repository), you can name which subdirectory to make the
557 output relative to by giving a <path> as an argument.
558
559 -a, --text
560 Treat all files as text.
561
562 --ignore-cr-at-eol
563 Ignore carriage-return at the end of line when doing a comparison.
564
565 --ignore-space-at-eol
566 Ignore changes in whitespace at EOL.
567
568 -b, --ignore-space-change
569 Ignore changes in amount of whitespace. This ignores whitespace at
570 line end, and considers all other sequences of one or more
571 whitespace characters to be equivalent.
572
573 -w, --ignore-all-space
574 Ignore whitespace when comparing lines. This ignores differences
575 even if one line has whitespace where the other line has none.
576
577 --ignore-blank-lines
578 Ignore changes whose lines are all blank.
579
580 --inter-hunk-context=<lines>
581 Show the context between diff hunks, up to the specified number of
582 lines, thereby fusing hunks that are close to each other. Defaults
583 to diff.interHunkContext or 0 if the config option is unset.
584
585 -W, --function-context
586 Show whole surrounding functions of changes.
587
588 --exit-code
589 Make the program exit with codes similar to diff(1). That is, it
590 exits with 1 if there were differences and 0 means no differences.
591
592 --quiet
593 Disable all output of the program. Implies --exit-code.
594
595 --ext-diff
596 Allow an external diff helper to be executed. If you set an
597 external diff driver with gitattributes(5), you need to use this
598 option with git-log(1) and friends.
599
600 --no-ext-diff
601 Disallow external diff drivers.
602
603 --textconv, --no-textconv
604 Allow (or disallow) external text conversion filters to be run when
605 comparing binary files. See gitattributes(5) for details. Because
606 textconv filters are typically a one-way conversion, the resulting
607 diff is suitable for human consumption, but cannot be applied. For
608 this reason, textconv filters are enabled by default only for git-
609 diff(1) and git-log(1), but not for git-format-patch(1) or diff
610 plumbing commands.
611
612 --ignore-submodules[=<when>]
613 Ignore changes to submodules in the diff generation. <when> can be
614 either "none", "untracked", "dirty" or "all", which is the default.
615 Using "none" will consider the submodule modified when it either
616 contains untracked or modified files or its HEAD differs from the
617 commit recorded in the superproject and can be used to override any
618 settings of the ignore option in git-config(1) or gitmodules(5).
619 When "untracked" is used submodules are not considered dirty when
620 they only contain untracked content (but they are still scanned for
621 modified content). Using "dirty" ignores all changes to the work
622 tree of submodules, only changes to the commits stored in the
623 superproject are shown (this was the behavior until 1.7.0). Using
624 "all" hides all changes to submodules.
625
626 --src-prefix=<prefix>
627 Show the given source prefix instead of "a/".
628
629 --dst-prefix=<prefix>
630 Show the given destination prefix instead of "b/".
631
632 --no-prefix
633 Do not show any source or destination prefix.
634
635 --line-prefix=<prefix>
636 Prepend an additional prefix to every line of output.
637
638 --ita-invisible-in-index
639 By default entries added by "git add -N" appear as an existing
640 empty file in "git diff" and a new file in "git diff --cached".
641 This option makes the entry appear as a new file in "git diff" and
642 non-existent in "git diff --cached". This option could be reverted
643 with --ita-visible-in-index. Both options are experimental and
644 could be removed in future.
645
646 For more detailed explanation on these common options, see also
647 gitdiffcore(7).
648
649 <tree-ish>
650 The id of a tree object.
651
652 <path>...
653 If provided, the results are limited to a subset of files matching
654 one of the provided pathspecs.
655
656 -r
657 recurse into sub-trees
658
659 -t
660 show tree entry itself as well as subtrees. Implies -r.
661
662 --root
663 When --root is specified the initial commit will be shown as a big
664 creation event. This is equivalent to a diff against the NULL tree.
665
666 --stdin
667 When --stdin is specified, the command does not take <tree-ish>
668 arguments from the command line. Instead, it reads lines containing
669 either two <tree>, one <commit>, or a list of <commit> from its
670 standard input. (Use a single space as separator.)
671
672 When two trees are given, it compares the first tree with the
673 second. When a single commit is given, it compares the commit with
674 its parents. The remaining commits, when given, are used as if they
675 are parents of the first commit.
676
677 When comparing two trees, the ID of both trees (separated by a
678 space and terminated by a newline) is printed before the
679 difference. When comparing commits, the ID of the first (or only)
680 commit, followed by a newline, is printed.
681
682 The following flags further affect the behavior when comparing
683 commits (but not trees).
684
685 -m
686 By default, git diff-tree --stdin does not show differences for
687 merge commits. With this flag, it shows differences to that commit
688 from all of its parents. See also -c.
689
690 -s
691 By default, git diff-tree --stdin shows differences, either in
692 machine-readable form (without -p) or in patch form (with -p). This
693 output can be suppressed. It is only useful with -v flag.
694
695 -v
696 This flag causes git diff-tree --stdin to also show the commit
697 message before the differences.
698
699 --pretty[=<format>], --format=<format>
700 Pretty-print the contents of the commit logs in a given format,
701 where <format> can be one of oneline, short, medium, full, fuller,
702 email, raw, format:<string> and tformat:<string>. When <format> is
703 none of the above, and has %placeholder in it, it acts as if
704 --pretty=tformat:<format> were given.
705
706 See the "PRETTY FORMATS" section for some additional details for
707 each format. When =<format> part is omitted, it defaults to medium.
708
709 Note: you can specify the default pretty format in the repository
710 configuration (see git-config(1)).
711
712 --abbrev-commit
713 Instead of showing the full 40-byte hexadecimal commit object name,
714 show only a partial prefix. Non default number of digits can be
715 specified with "--abbrev=<n>" (which also modifies diff output, if
716 it is displayed).
717
718 This should make "--pretty=oneline" a whole lot more readable for
719 people using 80-column terminals.
720
721 --no-abbrev-commit
722 Show the full 40-byte hexadecimal commit object name. This negates
723 --abbrev-commit and those options which imply it such as
724 "--oneline". It also overrides the log.abbrevCommit variable.
725
726 --oneline
727 This is a shorthand for "--pretty=oneline --abbrev-commit" used
728 together.
729
730 --encoding=<encoding>
731 The commit objects record the encoding used for the log message in
732 their encoding header; this option can be used to tell the command
733 to re-code the commit log message in the encoding preferred by the
734 user. For non plumbing commands this defaults to UTF-8. Note that
735 if an object claims to be encoded in X and we are outputting in X,
736 we will output the object verbatim; this means that invalid
737 sequences in the original commit may be copied to the output.
738
739 --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
740 Perform a tab expansion (replace each tab with enough spaces to
741 fill to the next display column that is multiple of <n>) in the log
742 message before showing it in the output. --expand-tabs is a
743 short-hand for --expand-tabs=8, and --no-expand-tabs is a
744 short-hand for --expand-tabs=0, which disables tab expansion.
745
746 By default, tabs are expanded in pretty formats that indent the log
747 message by 4 spaces (i.e. medium, which is the default, full, and
748 fuller).
749
750 --notes[=<treeish>]
751 Show the notes (see git-notes(1)) that annotate the commit, when
752 showing the commit log message. This is the default for git log,
753 git show and git whatchanged commands when there is no --pretty,
754 --format, or --oneline option given on the command line.
755
756 By default, the notes shown are from the notes refs listed in the
757 core.notesRef and notes.displayRef variables (or corresponding
758 environment overrides). See git-config(1) for more details.
759
760 With an optional <treeish> argument, use the treeish to find the
761 notes to display. The treeish can specify the full refname when it
762 begins with refs/notes/; when it begins with notes/, refs/ and
763 otherwise refs/notes/ is prefixed to form a full name of the ref.
764
765 Multiple --notes options can be combined to control which notes are
766 being displayed. Examples: "--notes=foo" will show only notes from
767 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
768 "refs/notes/foo" and from the default notes ref(s).
769
770 --no-notes
771 Do not show notes. This negates the above --notes option, by
772 resetting the list of notes refs from which notes are shown.
773 Options are parsed in the order given on the command line, so e.g.
774 "--notes --notes=foo --no-notes --notes=bar" will only show notes
775 from "refs/notes/bar".
776
777 --show-notes[=<treeish>], --[no-]standard-notes
778 These options are deprecated. Use the above --notes/--no-notes
779 options instead.
780
781 --show-signature
782 Check the validity of a signed commit object by passing the
783 signature to gpg --verify and show the output.
784
785 --no-commit-id
786 git diff-tree outputs a line with the commit ID when applicable.
787 This flag suppressed the commit ID output.
788
789 -c
790 This flag changes the way a merge commit is displayed (which means
791 it is useful only when the command is given one <tree-ish>, or
792 --stdin). It shows the differences from each of the parents to the
793 merge result simultaneously instead of showing pairwise diff
794 between a parent and the result one at a time (which is what the -m
795 option does). Furthermore, it lists only files which were modified
796 from all parents.
797
798 --cc
799 This flag changes the way a merge commit patch is displayed, in a
800 similar way to the -c option. It implies the -c and -p options and
801 further compresses the patch output by omitting uninteresting hunks
802 whose the contents in the parents have only two variants and the
803 merge result picks one of them without modification. When all hunks
804 are uninteresting, the commit itself and the commit log message is
805 not shown, just like in any other "empty diff" case.
806
807 --always
808 Show the commit itself and the commit log message even if the diff
809 itself is empty.
810
812 If the commit is a merge, and if the pretty-format is not oneline,
813 email or raw, an additional line is inserted before the Author: line.
814 This line begins with "Merge: " and the sha1s of ancestral commits are
815 printed, separated by spaces. Note that the listed commits may not
816 necessarily be the list of the direct parent commits if you have
817 limited your view of history: for example, if you are only interested
818 in changes related to a certain directory or file.
819
820 There are several built-in formats, and you can define additional
821 formats by setting a pretty.<name> config option to either another
822 format name, or a format: string, as described below (see git-
823 config(1)). Here are the details of the built-in formats:
824
825 · oneline
826
827 <sha1> <title line>
828
829 This is designed to be as compact as possible.
830
831 · short
832
833 commit <sha1>
834 Author: <author>
835
836 <title line>
837
838 · medium
839
840 commit <sha1>
841 Author: <author>
842 Date: <author date>
843
844 <title line>
845
846 <full commit message>
847
848 · full
849
850 commit <sha1>
851 Author: <author>
852 Commit: <committer>
853
854 <title line>
855
856 <full commit message>
857
858 · fuller
859
860 commit <sha1>
861 Author: <author>
862 AuthorDate: <author date>
863 Commit: <committer>
864 CommitDate: <committer date>
865
866 <title line>
867
868 <full commit message>
869
870 · email
871
872 From <sha1> <date>
873 From: <author>
874 Date: <author date>
875 Subject: [PATCH] <title line>
876
877 <full commit message>
878
879 · raw
880
881 The raw format shows the entire commit exactly as stored in the
882 commit object. Notably, the SHA-1s are displayed in full,
883 regardless of whether --abbrev or --no-abbrev are used, and parents
884 information show the true parent commits, without taking grafts or
885 history simplification into account. Note that this format affects
886 the way commits are displayed, but not the way the diff is shown
887 e.g. with git log --raw. To get full object names in a raw diff
888 format, use --no-abbrev.
889
890 · format:<string>
891
892 The format:<string> format allows you to specify which information
893 you want to show. It works a little bit like printf format, with
894 the notable exception that you get a newline with %n instead of \n.
895
896 E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
897 would show something like this:
898
899 The author of fe6e0ee was Junio C Hamano, 23 hours ago
900 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
901
902 The placeholders are:
903
904 · %H: commit hash
905
906 · %h: abbreviated commit hash
907
908 · %T: tree hash
909
910 · %t: abbreviated tree hash
911
912 · %P: parent hashes
913
914 · %p: abbreviated parent hashes
915
916 · %an: author name
917
918 · %aN: author name (respecting .mailmap, see git-shortlog(1) or
919 git-blame(1))
920
921 · %ae: author email
922
923 · %aE: author email (respecting .mailmap, see git-shortlog(1) or
924 git-blame(1))
925
926 · %ad: author date (format respects --date= option)
927
928 · %aD: author date, RFC2822 style
929
930 · %ar: author date, relative
931
932 · %at: author date, UNIX timestamp
933
934 · %ai: author date, ISO 8601-like format
935
936 · %aI: author date, strict ISO 8601 format
937
938 · %cn: committer name
939
940 · %cN: committer name (respecting .mailmap, see git-shortlog(1)
941 or git-blame(1))
942
943 · %ce: committer email
944
945 · %cE: committer email (respecting .mailmap, see git-shortlog(1)
946 or git-blame(1))
947
948 · %cd: committer date (format respects --date= option)
949
950 · %cD: committer date, RFC2822 style
951
952 · %cr: committer date, relative
953
954 · %ct: committer date, UNIX timestamp
955
956 · %ci: committer date, ISO 8601-like format
957
958 · %cI: committer date, strict ISO 8601 format
959
960 · %d: ref names, like the --decorate option of git-log(1)
961
962 · %D: ref names without the " (", ")" wrapping.
963
964 · %S: ref name given on the command line by which the commit was
965 reached (like git log --source), only works with git log
966
967 · %e: encoding
968
969 · %s: subject
970
971 · %f: sanitized subject line, suitable for a filename
972
973 · %b: body
974
975 · %B: raw body (unwrapped subject and body)
976
977 · %N: commit notes
978
979 · %GG: raw verification message from GPG for a signed commit
980
981 · %G?: show "G" for a good (valid) signature, "B" for a bad
982 signature, "U" for a good signature with unknown validity, "X"
983 for a good signature that has expired, "Y" for a good signature
984 made by an expired key, "R" for a good signature made by a
985 revoked key, "E" if the signature cannot be checked (e.g.
986 missing key) and "N" for no signature
987
988 · %GS: show the name of the signer for a signed commit
989
990 · %GK: show the key used to sign a signed commit
991
992 · %GF: show the fingerprint of the key used to sign a signed
993 commit
994
995 · %GP: show the fingerprint of the primary key whose subkey was
996 used to sign a signed commit
997
998 · %gD: reflog selector, e.g., refs/stash@{1} or refs/stash@{2
999 minutes ago}; the format follows the rules described for the -g
1000 option. The portion before the @ is the refname as given on the
1001 command line (so git log -g refs/heads/master would yield
1002 refs/heads/master@{0}).
1003
1004 · %gd: shortened reflog selector; same as %gD, but the refname
1005 portion is shortened for human readability (so
1006 refs/heads/master becomes just master).
1007
1008 · %gn: reflog identity name
1009
1010 · %gN: reflog identity name (respecting .mailmap, see git-
1011 shortlog(1) or git-blame(1))
1012
1013 · %ge: reflog identity email
1014
1015 · %gE: reflog identity email (respecting .mailmap, see git-
1016 shortlog(1) or git-blame(1))
1017
1018 · %gs: reflog subject
1019
1020 · %Cred: switch color to red
1021
1022 · %Cgreen: switch color to green
1023
1024 · %Cblue: switch color to blue
1025
1026 · %Creset: reset color
1027
1028 · %C(...): color specification, as described under Values in the
1029 "CONFIGURATION FILE" section of git-config(1). By default,
1030 colors are shown only when enabled for log output (by
1031 color.diff, color.ui, or --color, and respecting the auto
1032 settings of the former if we are going to a terminal).
1033 %C(auto,...) is accepted as a historical synonym for the
1034 default (e.g., %C(auto,red)). Specifying %C(always,...) will
1035 show the colors even when color is not otherwise enabled
1036 (though consider just using --color=always to enable color for
1037 the whole output, including this format and anything else git
1038 might color). auto alone (i.e. %C(auto)) will turn on auto
1039 coloring on the next placeholders until the color is switched
1040 again.
1041
1042 · %m: left (<), right (>) or boundary (-) mark
1043
1044 · %n: newline
1045
1046 · %%: a raw %
1047
1048 · %x00: print a byte from a hex code
1049
1050 · %w([<w>[,<i1>[,<i2>]]]): switch line wrapping, like the -w
1051 option of git-shortlog(1).
1052
1053 · %<(<N>[,trunc|ltrunc|mtrunc]): make the next placeholder take
1054 at least N columns, padding spaces on the right if necessary.
1055 Optionally truncate at the beginning (ltrunc), the middle
1056 (mtrunc) or the end (trunc) if the output is longer than N
1057 columns. Note that truncating only works correctly with N >= 2.
1058
1059 · %<|(<N>): make the next placeholder take at least until Nth
1060 columns, padding spaces on the right if necessary
1061
1062 · %>(<N>), %>|(<N>): similar to %<(<N>), %<|(<N>) respectively,
1063 but padding spaces on the left
1064
1065 · %>>(<N>), %>>|(<N>): similar to %>(<N>), %>|(<N>) respectively,
1066 except that if the next placeholder takes more spaces than
1067 given and there are spaces on its left, use those spaces
1068
1069 · %><(<N>), %><|(<N>): similar to %<(<N>), %<|(<N>) respectively,
1070 but padding both sides (i.e. the text is centered)
1071
1072 · %(trailers[:options]): display the trailers of the body as
1073 interpreted by git-interpret-trailers(1). The trailers string
1074 may be followed by a colon and zero or more comma-separated
1075 options. If the only option is given, omit non-trailer lines
1076 from the trailer block. If the unfold option is given, behave
1077 as if interpret-trailer’s --unfold option was given. E.g.,
1078 %(trailers:only,unfold) to do both.
1079
1080 Note
1081 Some placeholders may depend on other options given to the revision
1082 traversal engine. For example, the %g* reflog options will insert
1083 an empty string unless we are traversing reflog entries (e.g., by
1084 git log -g). The %d and %D placeholders will use the "short"
1085 decoration format if --decorate was not already provided on the
1086 command line.
1087
1088 If you add a + (plus sign) after % of a placeholder, a line-feed is
1089 inserted immediately before the expansion if and only if the
1090 placeholder expands to a non-empty string.
1091
1092 If you add a - (minus sign) after % of a placeholder, all consecutive
1093 line-feeds immediately preceding the expansion are deleted if and only
1094 if the placeholder expands to an empty string.
1095
1096 If you add a ` ` (space) after % of a placeholder, a space is inserted
1097 immediately before the expansion if and only if the placeholder expands
1098 to a non-empty string.
1099
1100 · tformat:
1101
1102 The tformat: format works exactly like format:, except that it
1103 provides "terminator" semantics instead of "separator" semantics.
1104 In other words, each commit has the message terminator character
1105 (usually a newline) appended, rather than a separator placed
1106 between entries. This means that the final entry of a single-line
1107 format will be properly terminated with a new line, just as the
1108 "oneline" format does. For example:
1109
1110 $ git log -2 --pretty=format:%h 4da45bef \
1111 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1112 4da45be
1113 7134973 -- NO NEWLINE
1114
1115 $ git log -2 --pretty=tformat:%h 4da45bef \
1116 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1117 4da45be
1118 7134973
1119
1120 In addition, any unrecognized string that has a % in it is
1121 interpreted as if it has tformat: in front of it. For example,
1122 these two are equivalent:
1123
1124 $ git log -2 --pretty=tformat:%h 4da45bef
1125 $ git log -2 --pretty=%h 4da45bef
1126
1127
1129 The raw output format from "git-diff-index", "git-diff-tree",
1130 "git-diff-files" and "git diff --raw" are very similar.
1131
1132 These commands all compare two sets of things; what is compared
1133 differs:
1134
1135 git-diff-index <tree-ish>
1136 compares the <tree-ish> and the files on the filesystem.
1137
1138 git-diff-index --cached <tree-ish>
1139 compares the <tree-ish> and the index.
1140
1141 git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
1142 compares the trees named by the two arguments.
1143
1144 git-diff-files [<pattern>...]
1145 compares the index and the files on the filesystem.
1146
1147 The "git-diff-tree" command begins its output by printing the hash of
1148 what is being compared. After that, all the commands print one output
1149 line per changed file.
1150
1151 An output line is formatted this way:
1152
1153 in-place edit :100644 100644 bcd1234 0123456 M file0
1154 copy-edit :100644 100644 abcd123 1234567 C68 file1 file2
1155 rename-edit :100644 100644 abcd123 1234567 R86 file1 file3
1156 create :000000 100644 0000000 1234567 A file4
1157 delete :100644 000000 1234567 0000000 D file5
1158 unmerged :000000 000000 0000000 0000000 U file6
1159
1160
1161 That is, from the left to the right:
1162
1163 1. a colon.
1164
1165 2. mode for "src"; 000000 if creation or unmerged.
1166
1167 3. a space.
1168
1169 4. mode for "dst"; 000000 if deletion or unmerged.
1170
1171 5. a space.
1172
1173 6. sha1 for "src"; 0{40} if creation or unmerged.
1174
1175 7. a space.
1176
1177 8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1178
1179 9. a space.
1180
1181 10. status, followed by optional "score" number.
1182
1183 11. a tab or a NUL when -z option is used.
1184
1185 12. path for "src"
1186
1187 13. a tab or a NUL when -z option is used; only exists for C or R.
1188
1189 14. path for "dst"; only exists for C or R.
1190
1191 15. an LF or a NUL when -z option is used, to terminate the record.
1192
1193 Possible status letters are:
1194
1195 · A: addition of a file
1196
1197 · C: copy of a file into a new one
1198
1199 · D: deletion of a file
1200
1201 · M: modification of the contents or mode of a file
1202
1203 · R: renaming of a file
1204
1205 · T: change in the type of the file
1206
1207 · U: file is unmerged (you must complete the merge before it can be
1208 committed)
1209
1210 · X: "unknown" change type (most probably a bug, please report it)
1211
1212 Status letters C and R are always followed by a score (denoting the
1213 percentage of similarity between the source and target of the move or
1214 copy). Status letter M may be followed by a score (denoting the
1215 percentage of dissimilarity) for file rewrites.
1216
1217 <sha1> is shown as all 0’s if a file is new on the filesystem and it is
1218 out of sync with the index.
1219
1220 Example:
1221
1222 :100644 100644 5be4a4a 0000000 M file.c
1223
1224
1225 Without the -z option, pathnames with "unusual" characters are quoted
1226 as explained for the configuration variable core.quotePath (see git-
1227 config(1)). Using -z the filename is output verbatim and the line is
1228 terminated by a NUL byte.
1229
1231 "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
1232 --cc option to generate diff output also for merge commits. The output
1233 differs from the format described above in the following way:
1234
1235 1. there is a colon for each parent
1236
1237 2. there are more "src" modes and "src" sha1
1238
1239 3. status is concatenated status characters for each parent
1240
1241 4. no optional "score" number
1242
1243 5. single path, only for "dst"
1244
1245 Example:
1246
1247 ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM describe.c
1248
1249
1250 Note that combined diff lists only files which were modified from all
1251 parents.
1252
1254 When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1255 with a -p option, "git diff" without the --raw option, or "git log"
1256 with the "-p" option, they do not produce the output described above;
1257 instead they produce a patch file. You can customize the creation of
1258 such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
1259 environment variables.
1260
1261 What the -p option produces is slightly different from the traditional
1262 diff format:
1263
1264 1. It is preceded with a "git diff" header that looks like this:
1265
1266 diff --git a/file1 b/file2
1267
1268 The a/ and b/ filenames are the same unless rename/copy is
1269 involved. Especially, even for a creation or a deletion, /dev/null
1270 is not used in place of the a/ or b/ filenames.
1271
1272 When rename/copy is involved, file1 and file2 show the name of the
1273 source file of the rename/copy and the name of the file that
1274 rename/copy produces, respectively.
1275
1276 2. It is followed by one or more extended header lines:
1277
1278 old mode <mode>
1279 new mode <mode>
1280 deleted file mode <mode>
1281 new file mode <mode>
1282 copy from <path>
1283 copy to <path>
1284 rename from <path>
1285 rename to <path>
1286 similarity index <number>
1287 dissimilarity index <number>
1288 index <hash>..<hash> <mode>
1289
1290 File modes are printed as 6-digit octal numbers including the file
1291 type and file permission bits.
1292
1293 Path names in extended headers do not include the a/ and b/
1294 prefixes.
1295
1296 The similarity index is the percentage of unchanged lines, and the
1297 dissimilarity index is the percentage of changed lines. It is a
1298 rounded down integer, followed by a percent sign. The similarity
1299 index value of 100% is thus reserved for two equal files, while
1300 100% dissimilarity means that no line from the old file made it
1301 into the new one.
1302
1303 The index line includes the SHA-1 checksum before and after the
1304 change. The <mode> is included if the file mode does not change;
1305 otherwise, separate lines indicate the old and the new mode.
1306
1307 3. Pathnames with "unusual" characters are quoted as explained for the
1308 configuration variable core.quotePath (see git-config(1)).
1309
1310 4. All the file1 files in the output refer to files before the commit,
1311 and all the file2 files refer to files after the commit. It is
1312 incorrect to apply each change to each file sequentially. For
1313 example, this patch will swap a and b:
1314
1315 diff --git a/a b/b
1316 rename from a
1317 rename to b
1318 diff --git a/b b/a
1319 rename from b
1320 rename to a
1321
1323 Any diff-generating command can take the -c or --cc option to produce a
1324 combined diff when showing a merge. This is the default format when
1325 showing merges with git-diff(1) or git-show(1). Note also that you can
1326 give the -m option to any of these commands to force generation of
1327 diffs with individual parents of a merge.
1328
1329 A combined diff format looks like this:
1330
1331 diff --combined describe.c
1332 index fabadb8,cc95eb0..4866510
1333 --- a/describe.c
1334 +++ b/describe.c
1335 @@@ -98,20 -98,12 +98,20 @@@
1336 return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1337 }
1338
1339 - static void describe(char *arg)
1340 -static void describe(struct commit *cmit, int last_one)
1341 ++static void describe(char *arg, int last_one)
1342 {
1343 + unsigned char sha1[20];
1344 + struct commit *cmit;
1345 struct commit_list *list;
1346 static int initialized = 0;
1347 struct commit_name *n;
1348
1349 + if (get_sha1(arg, sha1) < 0)
1350 + usage(describe_usage);
1351 + cmit = lookup_commit_reference(sha1);
1352 + if (!cmit)
1353 + usage(describe_usage);
1354 +
1355 if (!initialized) {
1356 initialized = 1;
1357 for_each_ref(get_name);
1358
1359
1360
1361 1. It is preceded with a "git diff" header, that looks like this (when
1362 -c option is used):
1363
1364 diff --combined file
1365
1366 or like this (when --cc option is used):
1367
1368 diff --cc file
1369
1370 2. It is followed by one or more extended header lines (this example
1371 shows a merge with two parents):
1372
1373 index <hash>,<hash>..<hash>
1374 mode <mode>,<mode>..<mode>
1375 new file mode <mode>
1376 deleted file mode <mode>,<mode>
1377
1378 The mode <mode>,<mode>..<mode> line appears only if at least one of
1379 the <mode> is different from the rest. Extended headers with
1380 information about detected contents movement (renames and copying
1381 detection) are designed to work with diff of two <tree-ish> and are
1382 not used by combined diff format.
1383
1384 3. It is followed by two-line from-file/to-file header
1385
1386 --- a/file
1387 +++ b/file
1388
1389 Similar to two-line header for traditional unified diff format,
1390 /dev/null is used to signal created or deleted files.
1391
1392 4. Chunk header format is modified to prevent people from accidentally
1393 feeding it to patch -p1. Combined diff format was created for
1394 review of merge commit changes, and was not meant for apply. The
1395 change is similar to the change in the extended index header:
1396
1397 @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1398
1399 There are (number of parents + 1) @ characters in the chunk header
1400 for combined diff format.
1401
1402 Unlike the traditional unified diff format, which shows two files A and
1403 B with a single column that has - (minus — appears in A but removed in
1404 B), + (plus — missing in A but added to B), or " " (space — unchanged)
1405 prefix, this format compares two or more files file1, file2,... with
1406 one file X, and shows how X differs from each of fileN. One column for
1407 each of fileN is prepended to the output line to note how X’s line is
1408 different from it.
1409
1410 A - character in the column N means that the line appears in fileN but
1411 it does not appear in the result. A + character in the column N means
1412 that the line appears in the result, and fileN does not have that line
1413 (in other words, the line was added, from the point of view of that
1414 parent).
1415
1416 In the above example output, the function signature was changed from
1417 both files (hence two - removals from both file1 and file2, plus ++ to
1418 mean one line that was added does not appear in either file1 or file2).
1419 Also eight other lines are the same from file1 but do not appear in
1420 file2 (hence prefixed with +).
1421
1422 When shown by git diff-tree -c, it compares the parents of a merge
1423 commit with the merge result (i.e. file1..fileN are the parents). When
1424 shown by git diff-files -c, it compares the two unresolved merge
1425 parents with the working tree file (i.e. file1 is stage 2 aka "our
1426 version", file2 is stage 3 aka "their version").
1427
1429 The --summary option describes newly added, deleted, renamed and copied
1430 files. The --stat option adds diffstat(1) graph to the output. These
1431 options can be combined with other options, such as -p, and are meant
1432 for human consumption.
1433
1434 When showing a change that involves a rename or a copy, --stat output
1435 formats the pathnames compactly by combining common prefix and suffix
1436 of the pathnames. For example, a change that moves arch/i386/Makefile
1437 to arch/x86/Makefile while modifying 4 lines will be shown like this:
1438
1439 arch/{i386 => x86}/Makefile | 4 +--
1440
1441
1442 The --numstat option gives the diffstat(1) information but is designed
1443 for easier machine consumption. An entry in --numstat output looks like
1444 this:
1445
1446 1 2 README
1447 3 1 arch/{i386 => x86}/Makefile
1448
1449
1450 That is, from left to right:
1451
1452 1. the number of added lines;
1453
1454 2. a tab;
1455
1456 3. the number of deleted lines;
1457
1458 4. a tab;
1459
1460 5. pathname (possibly with rename/copy information);
1461
1462 6. a newline.
1463
1464 When -z output option is in effect, the output is formatted this way:
1465
1466 1 2 README NUL
1467 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
1468
1469
1470 That is:
1471
1472 1. the number of added lines;
1473
1474 2. a tab;
1475
1476 3. the number of deleted lines;
1477
1478 4. a tab;
1479
1480 5. a NUL (only exists if renamed/copied);
1481
1482 6. pathname in preimage;
1483
1484 7. a NUL (only exists if renamed/copied);
1485
1486 8. pathname in postimage (only exists if renamed/copied);
1487
1488 9. a NUL.
1489
1490 The extra NUL before the preimage path in renamed case is to allow
1491 scripts that read the output to tell if the current record being read
1492 is a single-path record or a rename/copy record without reading ahead.
1493 After reading added and deleted lines, reading up to NUL would yield
1494 the pathname, but if that is NUL, the record will show two paths.
1495
1497 Part of the git(1) suite
1498
1499
1500
1501Git 2.21.0 02/24/2019 GIT-DIFF-TREE(1)