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

NAME

6       git-diff-files - Compares files in the working tree and the index
7

SYNOPSIS

9       git diff-files [-q] [-0|-1|-2|-3|-c|--cc] [<common diff options>] [<path>...]
10
11

DESCRIPTION

13       Compares the files in the working tree and the index. When paths are
14       specified, compares only those named paths. Otherwise all entries in
15       the index are compared. The output format is the same as for git
16       diff-index and git diff-tree.
17

OPTIONS

19       -p, -u, --patch
20           Generate patch (see section on generating patches).
21
22       -U<n>, --unified=<n>
23           Generate diffs with <n> lines of context instead of the usual
24           three. Implies -p.
25
26       --raw
27           Generate the raw format. This is the default.
28
29       --patch-with-raw
30           Synonym for -p --raw.
31
32       --minimal
33           Spend extra time to make sure the smallest possible diff is
34           produced.
35
36       --patience
37           Generate a diff using the "patience diff" algorithm.
38
39       --histogram
40           Generate a diff using the "histogram diff" algorithm.
41
42       --diff-algorithm={patience|minimal|histogram|myers}
43           Choose a diff algorithm. The variants are as follows:
44
45           default, myers
46               The basic greedy diff algorithm. Currently, this is the
47               default.
48
49           minimal
50               Spend extra time to make sure the smallest possible diff is
51               produced.
52
53           patience
54               Use "patience diff" algorithm when generating patches.
55
56           histogram
57               This algorithm extends the patience algorithm to "support
58               low-occurrence common elements".
59
60           For instance, if you configured diff.algorithm variable to a
61           non-default value and want to use the default one, then you have to
62           use --diff-algorithm=default option.
63
64       --stat[=<width>[,<name-width>[,<count>]]]
65           Generate a diffstat. By default, as much space as necessary will be
66           used for the filename part, and the rest for the graph part.
67           Maximum width defaults to terminal width, or 80 columns if not
68           connected to a terminal, and can be overridden by <width>. The
69           width of the filename part can be limited by giving another width
70           <name-width> after a comma. The width of the graph part can be
71           limited by using --stat-graph-width=<width> (affects all commands
72           generating a stat graph) or by setting diff.statGraphWidth=<width>
73           (does not affect git format-patch). By giving a third parameter
74           <count>, you can limit the output to the first <count> lines,
75           followed by ...  if there are more.
76
77           These parameters can also be set individually with
78           --stat-width=<width>, --stat-name-width=<name-width> and
79           --stat-count=<count>.
80
81       --numstat
82           Similar to --stat, but shows number of added and deleted lines in
83           decimal notation and pathname without abbreviation, to make it more
84           machine friendly. For binary files, outputs two - instead of saying
85           0 0.
86
87       --shortstat
88           Output only the last line of the --stat format containing total
89           number of modified files, as well as number of added and deleted
90           lines.
91
92       --dirstat[=<param1,param2,...>]
93           Output the distribution of relative amount of changes for each
94           sub-directory. The behavior of --dirstat can be customized by
95           passing it a comma separated list of parameters. The defaults are
96           controlled by the diff.dirstat configuration variable (see git-
97           config(1)). The following parameters are available:
98
99           changes
100               Compute the dirstat numbers by counting the lines that have
101               been removed from the source, or added to the destination. This
102               ignores the amount of pure code movements within a file. In
103               other words, rearranging lines in a file is not counted as much
104               as other changes. This is the default behavior when no
105               parameter is given.
106
107           lines
108               Compute the dirstat numbers by doing the regular line-based
109               diff analysis, and summing the removed/added line counts. (For
110               binary files, count 64-byte chunks instead, since binary files
111               have no natural concept of lines). This is a more expensive
112               --dirstat behavior than the changes behavior, but it does count
113               rearranged lines within a file as much as other changes. The
114               resulting output is consistent with what you get from the other
115               --*stat options.
116
117           files
118               Compute the dirstat numbers by counting the number of files
119               changed. Each changed file counts equally in the dirstat
120               analysis. This is the computationally cheapest --dirstat
121               behavior, since it does not have to look at the file contents
122               at all.
123
124           cumulative
125               Count changes in a child directory for the parent directory as
126               well. Note that when using cumulative, the sum of the
127               percentages reported may exceed 100%. The default
128               (non-cumulative) behavior can be specified with the
129               noncumulative parameter.
130
131           <limit>
132               An integer parameter specifies a cut-off percent (3% by
133               default). Directories contributing less than this percentage of
134               the changes are not shown in the output.
135
136           Example: The following will count changed files, while ignoring
137           directories with less than 10% of the total amount of changed
138           files, and accumulating child directory counts in the parent
139           directories: --dirstat=files,10,cumulative.
140
141       --summary
142           Output a condensed summary of extended header information such as
143           creations, renames and mode changes.
144
145       --patch-with-stat
146           Synonym for -p --stat.
147
148       -z
149           When --raw, --numstat, --name-only or --name-status has been given,
150           do not munge pathnames and use NULs as output field terminators.
151
152           Without this option, each pathname output will have TAB, LF, double
153           quotes, and backslash characters replaced with \t, \n, \", and \\,
154           respectively, and the pathname will be enclosed in double quotes if
155           any of those replacements occurred.
156
157       --name-only
158           Show only names of changed files.
159
160       --name-status
161           Show only names and status of changed files. See the description of
162           the --diff-filter option on what the status letters mean.
163
164       --submodule[=<format>]
165           Specify how differences in submodules are shown. When --submodule
166           or --submodule=log is given, the log format is used. This format
167           lists the commits in the range like git-submodule(1)summary does.
168           Omitting the --submodule option or specifying --submodule=short,
169           uses the short format. This format just shows the names of the
170           commits at the beginning and end of the range. Can be tweaked via
171           the diff.submodule configuration variable.
172
173       --color[=<when>]
174           Show colored diff.  --color (i.e. without =<when>) is the same as
175           --color=always.  <when> can be one of always, never, or auto.
176
177       --no-color
178           Turn off colored diff. It is the same as --color=never.
179
180       --word-diff[=<mode>]
181           Show a word diff, using the <mode> to delimit changed words. By
182           default, words are delimited by whitespace; see --word-diff-regex
183           below. The <mode> defaults to plain, and must be one of:
184
185           color
186               Highlight changed words using only colors. Implies --color.
187
188           plain
189               Show words as [-removed-] and {+added+}. Makes no attempts to
190               escape the delimiters if they appear in the input, so the
191               output may be ambiguous.
192
193           porcelain
194               Use a special line-based format intended for script
195               consumption. Added/removed/unchanged runs are printed in the
196               usual unified diff format, starting with a +/-/` ` character at
197               the beginning of the line and extending to the end of the line.
198               Newlines in the input are represented by a tilde ~ on a line of
199               its own.
200
201           none
202               Disable word diff again.
203
204           Note that despite the name of the first mode, color is used to
205           highlight the changed parts in all modes if enabled.
206
207       --word-diff-regex=<regex>
208           Use <regex> to decide what a word is, instead of considering runs
209           of non-whitespace to be a word. Also implies --word-diff unless it
210           was already enabled.
211
212           Every non-overlapping match of the <regex> is considered a word.
213           Anything between these matches is considered whitespace and
214           ignored(!) for the purposes of finding differences. You may want to
215           append |[^[:space:]] to your regular expression to make sure that
216           it matches all non-whitespace characters. A match that contains a
217           newline is silently truncated(!) at the newline.
218
219           The regex can also be set via a diff driver or configuration
220           option, see gitattributes(1) or git-config(1). Giving it explicitly
221           overrides any diff driver or configuration setting. Diff drivers
222           override configuration settings.
223
224       --color-words[=<regex>]
225           Equivalent to --word-diff=color plus (if a regex was specified)
226           --word-diff-regex=<regex>.
227
228       --no-renames
229           Turn off rename detection, even when the configuration file gives
230           the default to do so.
231
232       --check
233           Warn if changes introduce whitespace errors. What are considered
234           whitespace errors is controlled by core.whitespace configuration.
235           By default, trailing whitespaces (including lines that solely
236           consist of whitespaces) and a space character that is immediately
237           followed by a tab character inside the initial indent of the line
238           are considered whitespace errors. Exits with non-zero status if
239           problems are found. Not compatible with --exit-code.
240
241       --full-index
242           Instead of the first handful of characters, show the full pre- and
243           post-image blob object names on the "index" line when generating
244           patch format output.
245
246       --binary
247           In addition to --full-index, output a binary diff that can be
248           applied with git-apply.
249
250       --abbrev[=<n>]
251           Instead of showing the full 40-byte hexadecimal object name in
252           diff-raw format output and diff-tree header lines, show only a
253           partial prefix. This is independent of the --full-index option
254           above, which controls the diff-patch output format. Non default
255           number of digits can be specified with --abbrev=<n>.
256
257       -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
258           Break complete rewrite changes into pairs of delete and create.
259           This serves two purposes:
260
261           It affects the way a change that amounts to a total rewrite of a
262           file not as a series of deletion and insertion mixed together with
263           a very few lines that happen to match textually as the context, but
264           as a single deletion of everything old followed by a single
265           insertion of everything new, and the number m controls this aspect
266           of the -B option (defaults to 60%).  -B/70% specifies that less
267           than 30% of the original should remain in the result for Git to
268           consider it a total rewrite (i.e. otherwise the resulting patch
269           will be a series of deletion and insertion mixed together with
270           context lines).
271
272           When used with -M, a totally-rewritten file is also considered as
273           the source of a rename (usually -M only considers a file that
274           disappeared as the source of a rename), and the number n controls
275           this aspect of the -B option (defaults to 50%).  -B20% specifies
276           that a change with addition and deletion compared to 20% or more of
277           the file’s size are eligible for being picked up as a possible
278           source of a rename to another file.
279
280       -M[<n>], --find-renames[=<n>]
281           Detect renames. If n is specified, it is a threshold on the
282           similarity index (i.e. amount of addition/deletions compared to the
283           file’s size). For example, -M90% means Git should consider a
284           delete/add pair to be a rename if more than 90% of the file hasn’t
285           changed. Without a % sign, the number is to be read as a fraction,
286           with a decimal point before it. I.e., -M5 becomes 0.5, and is thus
287           the same as -M50%. Similarly, -M05 is the same as -M5%. To limit
288           detection to exact renames, use -M100%.
289
290       -C[<n>], --find-copies[=<n>]
291           Detect copies as well as renames. See also --find-copies-harder. If
292           n is specified, it has the same meaning as for -M<n>.
293
294       --find-copies-harder
295           For performance reasons, by default, -C option finds copies only if
296           the original file of the copy was modified in the same changeset.
297           This flag makes the command inspect unmodified files as candidates
298           for the source of copy. This is a very expensive operation for
299           large projects, so use it with caution. Giving more than one -C
300           option has the same effect.
301
302       -D, --irreversible-delete
303           Omit the preimage for deletes, i.e. print only the header but not
304           the diff between the preimage and /dev/null. The resulting patch is
305           not meant to be applied with patch nor git apply; this is solely
306           for people who want to just concentrate on reviewing the text after
307           the change. In addition, the output obviously lack enough
308           information to apply such a patch in reverse, even manually, hence
309           the name of the option.
310
311           When used together with -B, omit also the preimage in the deletion
312           part of a delete/create pair.
313
314       -l<num>
315           The -M and -C options require O(n^2) processing time where n is the
316           number of potential rename/copy targets. This option prevents
317           rename/copy detection from running if the number of rename/copy
318           targets exceeds the specified number.
319
320       --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
321           Select only files that are Added (A), Copied (C), Deleted (D),
322           Modified (M), Renamed (R), have their type (i.e. regular file,
323           symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
324           (X), or have had their pairing Broken (B). Any combination of the
325           filter characters (including none) can be used. When *
326           (All-or-none) is added to the combination, all paths are selected
327           if there is any file that matches other criteria in the comparison;
328           if there is no file that matches other criteria, nothing is
329           selected.
330
331       -S<string>
332           Look for differences that introduce or remove an instance of
333           <string>. Note that this is different than the string simply
334           appearing in diff output; see the pickaxe entry in gitdiffcore(7)
335           for more details.
336
337       -G<regex>
338           Look for differences whose added or removed line matches the given
339           <regex>.
340
341       --pickaxe-all
342           When -S or -G finds a change, show all the changes in that
343           changeset, not just the files that contain the change in <string>.
344
345       --pickaxe-regex
346           Make the <string> not a plain string but an extended POSIX regex to
347           match.
348
349       -O<orderfile>
350           Output the patch in the order specified in the <orderfile>, which
351           has one shell glob pattern per line.
352
353       -R
354           Swap two inputs; that is, show differences from index or on-disk
355           file to tree contents.
356
357       --relative[=<path>]
358           When run from a subdirectory of the project, it can be told to
359           exclude changes outside the directory and show pathnames relative
360           to it with this option. When you are not in a subdirectory (e.g. in
361           a bare repository), you can name which subdirectory to make the
362           output relative to by giving a <path> as an argument.
363
364       -a, --text
365           Treat all files as text.
366
367       --ignore-space-at-eol
368           Ignore changes in whitespace at EOL.
369
370       -b, --ignore-space-change
371           Ignore changes in amount of whitespace. This ignores whitespace at
372           line end, and considers all other sequences of one or more
373           whitespace characters to be equivalent.
374
375       -w, --ignore-all-space
376           Ignore whitespace when comparing lines. This ignores differences
377           even if one line has whitespace where the other line has none.
378
379       --inter-hunk-context=<lines>
380           Show the context between diff hunks, up to the specified number of
381           lines, thereby fusing hunks that are close to each other.
382
383       -W, --function-context
384           Show whole surrounding functions of changes.
385
386       --exit-code
387           Make the program exit with codes similar to diff(1). That is, it
388           exits with 1 if there were differences and 0 means no differences.
389
390       --quiet
391           Disable all output of the program. Implies --exit-code.
392
393       --ext-diff
394           Allow an external diff helper to be executed. If you set an
395           external diff driver with gitattributes(5), you need to use this
396           option with git-log(1) and friends.
397
398       --no-ext-diff
399           Disallow external diff drivers.
400
401       --textconv, --no-textconv
402           Allow (or disallow) external text conversion filters to be run when
403           comparing binary files. See gitattributes(5) for details. Because
404           textconv filters are typically a one-way conversion, the resulting
405           diff is suitable for human consumption, but cannot be applied. For
406           this reason, textconv filters are enabled by default only for git-
407           diff(1) and git-log(1), but not for git-format-patch(1) or diff
408           plumbing commands.
409
410       --ignore-submodules[=<when>]
411           Ignore changes to submodules in the diff generation. <when> can be
412           either "none", "untracked", "dirty" or "all", which is the default.
413           Using "none" will consider the submodule modified when it either
414           contains untracked or modified files or its HEAD differs from the
415           commit recorded in the superproject and can be used to override any
416           settings of the ignore option in git-config(1) or gitmodules(5).
417           When "untracked" is used submodules are not considered dirty when
418           they only contain untracked content (but they are still scanned for
419           modified content). Using "dirty" ignores all changes to the work
420           tree of submodules, only changes to the commits stored in the
421           superproject are shown (this was the behavior until 1.7.0). Using
422           "all" hides all changes to submodules.
423
424       --src-prefix=<prefix>
425           Show the given source prefix instead of "a/".
426
427       --dst-prefix=<prefix>
428           Show the given destination prefix instead of "b/".
429
430       --no-prefix
431           Do not show any source or destination prefix.
432
433       For more detailed explanation on these common options, see also
434       gitdiffcore(7).
435
436       -1 --base, -2 --ours, -3 --theirs, -0
437           Diff against the "base" version, "our branch" or "their branch"
438           respectively. With these options, diffs for merged entries are not
439           shown.
440
441           The default is to diff against our branch (-2) and the cleanly
442           resolved paths. The option -0 can be given to omit diff output for
443           unmerged entries and just show "Unmerged".
444
445       -c, --cc
446           This compares stage 2 (our branch), stage 3 (their branch) and the
447           working tree file and outputs a combined diff, similar to the way
448           diff-tree shows a merge commit with these flags.
449
450       -q
451           Remain silent even on nonexistent files
452

RAW OUTPUT FORMAT

454       The raw output format from "git-diff-index", "git-diff-tree",
455       "git-diff-files" and "git diff --raw" are very similar.
456
457       These commands all compare two sets of things; what is compared
458       differs:
459
460       git-diff-index <tree-ish>
461           compares the <tree-ish> and the files on the filesystem.
462
463       git-diff-index --cached <tree-ish>
464           compares the <tree-ish> and the index.
465
466       git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]
467           compares the trees named by the two arguments.
468
469       git-diff-files [<pattern>...]
470           compares the index and the files on the filesystem.
471
472       The "git-diff-tree" command begins its output by printing the hash of
473       what is being compared. After that, all the commands print one output
474       line per changed file.
475
476       An output line is formatted this way:
477
478           in-place edit  :100644 100644 bcd1234... 0123456... M file0
479           copy-edit      :100644 100644 abcd123... 1234567... C68 file1 file2
480           rename-edit    :100644 100644 abcd123... 1234567... R86 file1 file3
481           create         :000000 100644 0000000... 1234567... A file4
482           delete         :100644 000000 1234567... 0000000... D file5
483           unmerged       :000000 000000 0000000... 0000000... U file6
484
485
486       That is, from the left to the right:
487
488        1. a colon.
489
490        2. mode for "src"; 000000 if creation or unmerged.
491
492        3. a space.
493
494        4. mode for "dst"; 000000 if deletion or unmerged.
495
496        5. a space.
497
498        6. sha1 for "src"; 0{40} if creation or unmerged.
499
500        7. a space.
501
502        8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
503
504        9. a space.
505
506       10. status, followed by optional "score" number.
507
508       11. a tab or a NUL when -z option is used.
509
510       12. path for "src"
511
512       13. a tab or a NUL when -z option is used; only exists for C or R.
513
514       14. path for "dst"; only exists for C or R.
515
516       15. an LF or a NUL when -z option is used, to terminate the record.
517
518       Possible status letters are:
519
520       ·   A: addition of a file
521
522       ·   C: copy of a file into a new one
523
524       ·   D: deletion of a file
525
526       ·   M: modification of the contents or mode of a file
527
528       ·   R: renaming of a file
529
530       ·   T: change in the type of the file
531
532       ·   U: file is unmerged (you must complete the merge before it can be
533           committed)
534
535       ·   X: "unknown" change type (most probably a bug, please report it)
536
537       Status letters C and R are always followed by a score (denoting the
538       percentage of similarity between the source and target of the move or
539       copy), and are the only ones to be so.
540
541       <sha1> is shown as all 0’s if a file is new on the filesystem and it is
542       out of sync with the index.
543
544       Example:
545
546           :100644 100644 5be4a4...... 000000...... M file.c
547
548
549       When -z option is not used, TAB, LF, and backslash characters in
550       pathnames are represented as \t, \n, and \\, respectively.
551

DIFF FORMAT FOR MERGES

553       "git-diff-tree", "git-diff-files" and "git-diff --raw" can take -c or
554       --cc option to generate diff output also for merge commits. The output
555       differs from the format described above in the following way:
556
557        1. there is a colon for each parent
558
559        2. there are more "src" modes and "src" sha1
560
561        3. status is concatenated status characters for each parent
562
563        4. no optional "score" number
564
565        5. single path, only for "dst"
566
567       Example:
568
569           ::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c
570
571
572       Note that combined diff lists only files which were modified from all
573       parents.
574

GENERATING PATCHES WITH -P

576       When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
577       with a -p option, "git diff" without the --raw option, or "git log"
578       with the "-p" option, they do not produce the output described above;
579       instead they produce a patch file. You can customize the creation of
580       such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
581       environment variables.
582
583       What the -p option produces is slightly different from the traditional
584       diff format:
585
586        1. It is preceded with a "git diff" header that looks like this:
587
588               diff --git a/file1 b/file2
589
590           The a/ and b/ filenames are the same unless rename/copy is
591           involved. Especially, even for a creation or a deletion, /dev/null
592           is not used in place of the a/ or b/ filenames.
593
594           When rename/copy is involved, file1 and file2 show the name of the
595           source file of the rename/copy and the name of the file that
596           rename/copy produces, respectively.
597
598        2. It is followed by one or more extended header lines:
599
600               old mode <mode>
601               new mode <mode>
602               deleted file mode <mode>
603               new file mode <mode>
604               copy from <path>
605               copy to <path>
606               rename from <path>
607               rename to <path>
608               similarity index <number>
609               dissimilarity index <number>
610               index <hash>..<hash> <mode>
611
612           File modes are printed as 6-digit octal numbers including the file
613           type and file permission bits.
614
615           Path names in extended headers do not include the a/ and b/
616           prefixes.
617
618           The similarity index is the percentage of unchanged lines, and the
619           dissimilarity index is the percentage of changed lines. It is a
620           rounded down integer, followed by a percent sign. The similarity
621           index value of 100% is thus reserved for two equal files, while
622           100% dissimilarity means that no line from the old file made it
623           into the new one.
624
625           The index line includes the SHA-1 checksum before and after the
626           change. The <mode> is included if the file mode does not change;
627           otherwise, separate lines indicate the old and the new mode.
628
629        3. TAB, LF, double quote and backslash characters in pathnames are
630           represented as \t, \n, \" and \\, respectively. If there is need
631           for such substitution then the whole pathname is put in double
632           quotes.
633
634        4. All the file1 files in the output refer to files before the commit,
635           and all the file2 files refer to files after the commit. It is
636           incorrect to apply each change to each file sequentially. For
637           example, this patch will swap a and b:
638
639               diff --git a/a b/b
640               rename from a
641               rename to b
642               diff --git a/b b/a
643               rename from b
644               rename to a
645

COMBINED DIFF FORMAT

647       Any diff-generating command can take the ‘-c` or --cc option to produce
648       a combined diff when showing a merge. This is the default format when
649       showing merges with git-diff(1) or git-show(1). Note also that you can
650       give the `-m’ option to any of these commands to force generation of
651       diffs with individual parents of a merge.
652
653       A combined diff format looks like this:
654
655           diff --combined describe.c
656           index fabadb8,cc95eb0..4866510
657           --- a/describe.c
658           +++ b/describe.c
659           @@@ -98,20 -98,12 +98,20 @@@
660                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
661             }
662
663           - static void describe(char *arg)
664            -static void describe(struct commit *cmit, int last_one)
665           ++static void describe(char *arg, int last_one)
666             {
667            +      unsigned char sha1[20];
668            +      struct commit *cmit;
669                   struct commit_list *list;
670                   static int initialized = 0;
671                   struct commit_name *n;
672
673            +      if (get_sha1(arg, sha1) < 0)
674            +              usage(describe_usage);
675            +      cmit = lookup_commit_reference(sha1);
676            +      if (!cmit)
677            +              usage(describe_usage);
678            +
679                   if (!initialized) {
680                           initialized = 1;
681                           for_each_ref(get_name);
682
683
684
685        1. It is preceded with a "git diff" header, that looks like this (when
686           -c option is used):
687
688               diff --combined file
689
690           or like this (when --cc option is used):
691
692               diff --cc file
693
694        2. It is followed by one or more extended header lines (this example
695           shows a merge with two parents):
696
697               index <hash>,<hash>..<hash>
698               mode <mode>,<mode>..<mode>
699               new file mode <mode>
700               deleted file mode <mode>,<mode>
701
702           The mode <mode>,<mode>..<mode> line appears only if at least one of
703           the <mode> is different from the rest. Extended headers with
704           information about detected contents movement (renames and copying
705           detection) are designed to work with diff of two <tree-ish> and are
706           not used by combined diff format.
707
708        3. It is followed by two-line from-file/to-file header
709
710               --- a/file
711               +++ b/file
712
713           Similar to two-line header for traditional unified diff format,
714           /dev/null is used to signal created or deleted files.
715
716        4. Chunk header format is modified to prevent people from accidentally
717           feeding it to patch -p1. Combined diff format was created for
718           review of merge commit changes, and was not meant for apply. The
719           change is similar to the change in the extended index header:
720
721               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
722
723           There are (number of parents + 1) @ characters in the chunk header
724           for combined diff format.
725
726       Unlike the traditional unified diff format, which shows two files A and
727       B with a single column that has - (minus — appears in A but removed in
728       B), + (plus — missing in A but added to B), or " " (space — unchanged)
729       prefix, this format compares two or more files file1, file2,... with
730       one file X, and shows how X differs from each of fileN. One column for
731       each of fileN is prepended to the output line to note how X’s line is
732       different from it.
733
734       A - character in the column N means that the line appears in fileN but
735       it does not appear in the result. A + character in the column N means
736       that the line appears in the result, and fileN does not have that line
737       (in other words, the line was added, from the point of view of that
738       parent).
739
740       In the above example output, the function signature was changed from
741       both files (hence two - removals from both file1 and file2, plus ++ to
742       mean one line that was added does not appear in either file1 nor
743       file2). Also eight other lines are the same from file1 but do not
744       appear in file2 (hence prefixed with +).
745
746       When shown by git diff-tree -c, it compares the parents of a merge
747       commit with the merge result (i.e. file1..fileN are the parents). When
748       shown by git diff-files -c, it compares the two unresolved merge
749       parents with the working tree file (i.e. file1 is stage 2 aka "our
750       version", file2 is stage 3 aka "their version").
751

OTHER DIFF FORMATS

753       The --summary option describes newly added, deleted, renamed and copied
754       files. The --stat option adds diffstat(1) graph to the output. These
755       options can be combined with other options, such as -p, and are meant
756       for human consumption.
757
758       When showing a change that involves a rename or a copy, --stat output
759       formats the pathnames compactly by combining common prefix and suffix
760       of the pathnames. For example, a change that moves arch/i386/Makefile
761       to arch/x86/Makefile while modifying 4 lines will be shown like this:
762
763           arch/{i386 => x86}/Makefile    |   4 +--
764
765
766       The --numstat option gives the diffstat(1) information but is designed
767       for easier machine consumption. An entry in --numstat output looks like
768       this:
769
770           1       2       README
771           3       1       arch/{i386 => x86}/Makefile
772
773
774       That is, from left to right:
775
776        1. the number of added lines;
777
778        2. a tab;
779
780        3. the number of deleted lines;
781
782        4. a tab;
783
784        5. pathname (possibly with rename/copy information);
785
786        6. a newline.
787
788       When -z output option is in effect, the output is formatted this way:
789
790           1       2       README NUL
791           3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
792
793
794       That is:
795
796        1. the number of added lines;
797
798        2. a tab;
799
800        3. the number of deleted lines;
801
802        4. a tab;
803
804        5. a NUL (only exists if renamed/copied);
805
806        6. pathname in preimage;
807
808        7. a NUL (only exists if renamed/copied);
809
810        8. pathname in postimage (only exists if renamed/copied);
811
812        9. a NUL.
813
814       The extra NUL before the preimage path in renamed case is to allow
815       scripts that read the output to tell if the current record being read
816       is a single-path record or a rename/copy record without reading ahead.
817       After reading added and deleted lines, reading up to NUL would yield
818       the pathname, but if that is NUL, the record will show two paths.
819

GIT

821       Part of the git(1) suite
822
823
824
825Git 1.8.3.1                       11/19/2018                 GIT-DIFF-FILES(1)
Impressum