1GIT-SHOW(1)                       Git Manual                       GIT-SHOW(1)
2
3
4

NAME

6       git-show - Show various types of objects
7

SYNOPSIS

9       git show [<options>] [<object>...]
10

DESCRIPTION

12       Shows one or more objects (blobs, trees, tags and commits).
13
14       For commits it shows the log message and textual diff. It also presents
15       the merge commit in a special format as produced by git diff-tree --cc.
16
17       For tags, it shows the tag message and the referenced objects.
18
19       For trees, it shows the names (equivalent to git ls-tree with
20       --name-only).
21
22       For plain blobs, it shows the plain contents.
23
24       The command takes options applicable to the git diff-tree command to
25       control how the changes the commit introduces are shown.
26
27       This manual page describes only the most frequently used options.
28

OPTIONS

30       <object>...
31           The names of objects to show (defaults to HEAD). For a more
32           complete list of ways to spell object names, see "SPECIFYING
33           REVISIONS" section in gitrevisions(7).
34
35       --pretty[=<format>], --format=<format>
36           Pretty-print the contents of the commit logs in a given format,
37           where <format> can be one of oneline, short, medium, full, fuller,
38           reference, email, raw, format:<string> and tformat:<string>. When
39           <format> is none of the above, and has %placeholder in it, it acts
40           as if --pretty=tformat:<format> were given.
41
42           See the "PRETTY FORMATS" section for some additional details for
43           each format. When =<format> part is omitted, it defaults to medium.
44
45           Note: you can specify the default pretty format in the repository
46           configuration (see git-config(1)).
47
48       --abbrev-commit
49           Instead of showing the full 40-byte hexadecimal commit object name,
50           show a prefix that names the object uniquely. "--abbrev=<n>" (which
51           also modifies diff output, if it is displayed) option can be used
52           to specify the minimum length of the prefix.
53
54           This should make "--pretty=oneline" a whole lot more readable for
55           people using 80-column terminals.
56
57       --no-abbrev-commit
58           Show the full 40-byte hexadecimal commit object name. This negates
59           --abbrev-commit, either explicit or implied by other options such
60           as "--oneline". It also overrides the log.abbrevCommit variable.
61
62       --oneline
63           This is a shorthand for "--pretty=oneline --abbrev-commit" used
64           together.
65
66       --encoding=<encoding>
67           Commit objects record the character encoding used for the log
68           message in their encoding header; this option can be used to tell
69           the command to re-code the commit log message in the encoding
70           preferred by the user. For non plumbing commands this defaults to
71           UTF-8. Note that if an object claims to be encoded in X and we are
72           outputting in X, we will output the object verbatim; this means
73           that invalid sequences in the original commit may be copied to the
74           output. Likewise, if iconv(3) fails to convert the commit, we will
75           quietly output the original object verbatim.
76
77       --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
78           Perform a tab expansion (replace each tab with enough spaces to
79           fill to the next display column that is multiple of <n>) in the log
80           message before showing it in the output.  --expand-tabs is a
81           short-hand for --expand-tabs=8, and --no-expand-tabs is a
82           short-hand for --expand-tabs=0, which disables tab expansion.
83
84           By default, tabs are expanded in pretty formats that indent the log
85           message by 4 spaces (i.e.  medium, which is the default, full, and
86           fuller).
87
88       --notes[=<ref>]
89           Show the notes (see git-notes(1)) that annotate the commit, when
90           showing the commit log message. This is the default for git log,
91           git show and git whatchanged commands when there is no --pretty,
92           --format, or --oneline option given on the command line.
93
94           By default, the notes shown are from the notes refs listed in the
95           core.notesRef and notes.displayRef variables (or corresponding
96           environment overrides). See git-config(1) for more details.
97
98           With an optional <ref> argument, use the ref to find the notes to
99           display. The ref can specify the full refname when it begins with
100           refs/notes/; when it begins with notes/, refs/ and otherwise
101           refs/notes/ is prefixed to form a full name of the ref.
102
103           Multiple --notes options can be combined to control which notes are
104           being displayed. Examples: "--notes=foo" will show only notes from
105           "refs/notes/foo"; "--notes=foo --notes" will show both notes from
106           "refs/notes/foo" and from the default notes ref(s).
107
108       --no-notes
109           Do not show notes. This negates the above --notes option, by
110           resetting the list of notes refs from which notes are shown.
111           Options are parsed in the order given on the command line, so e.g.
112           "--notes --notes=foo --no-notes --notes=bar" will only show notes
113           from "refs/notes/bar".
114
115       --show-notes[=<ref>], --[no-]standard-notes
116           These options are deprecated. Use the above --notes/--no-notes
117           options instead.
118
119       --show-signature
120           Check the validity of a signed commit object by passing the
121           signature to gpg --verify and show the output.
122

PRETTY FORMATS

124       If the commit is a merge, and if the pretty-format is not oneline,
125       email or raw, an additional line is inserted before the Author: line.
126       This line begins with "Merge: " and the hashes of ancestral commits are
127       printed, separated by spaces. Note that the listed commits may not
128       necessarily be the list of the direct parent commits if you have
129       limited your view of history: for example, if you are only interested
130       in changes related to a certain directory or file.
131
132       There are several built-in formats, and you can define additional
133       formats by setting a pretty.<name> config option to either another
134       format name, or a format: string, as described below (see git-
135       config(1)). Here are the details of the built-in formats:
136
137oneline
138
139               <hash> <title-line>
140
141           This is designed to be as compact as possible.
142
143short
144
145               commit <hash>
146               Author: <author>
147
148               <title-line>
149
150medium
151
152               commit <hash>
153               Author: <author>
154               Date:   <author-date>
155
156               <title-line>
157
158               <full-commit-message>
159
160full
161
162               commit <hash>
163               Author: <author>
164               Commit: <committer>
165
166               <title-line>
167
168               <full-commit-message>
169
170fuller
171
172               commit <hash>
173               Author:     <author>
174               AuthorDate: <author-date>
175               Commit:     <committer>
176               CommitDate: <committer-date>
177
178               <title-line>
179
180               <full-commit-message>
181
182reference
183
184               <abbrev-hash> (<title-line>, <short-author-date>)
185
186           This format is used to refer to another commit in a commit message
187           and is the same as --pretty='format:%C(auto)%h (%s, %ad)'. By
188           default, the date is formatted with --date=short unless another
189           --date option is explicitly specified. As with any format: with
190           format placeholders, its output is not affected by other options
191           like --decorate and --walk-reflogs.
192
193email
194
195               From <hash> <date>
196               From: <author>
197               Date: <author-date>
198               Subject: [PATCH] <title-line>
199
200               <full-commit-message>
201
202mboxrd
203
204           Like email, but lines in the commit message starting with "From "
205           (preceded by zero or more ">") are quoted with ">" so they aren’t
206           confused as starting a new commit.
207
208raw
209
210           The raw format shows the entire commit exactly as stored in the
211           commit object. Notably, the hashes are displayed in full,
212           regardless of whether --abbrev or --no-abbrev are used, and parents
213           information show the true parent commits, without taking grafts or
214           history simplification into account. Note that this format affects
215           the way commits are displayed, but not the way the diff is shown
216           e.g. with git log --raw. To get full object names in a raw diff
217           format, use --no-abbrev.
218
219format:<format-string>
220
221           The format:<format-string> format allows you to specify which
222           information you want to show. It works a little bit like printf
223           format, with the notable exception that you get a newline with %n
224           instead of \n.
225
226           E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
227           would show something like this:
228
229               The author of fe6e0ee was Junio C Hamano, 23 hours ago
230               The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
231
232           The placeholders are:
233
234           •   Placeholders that expand to a single literal character:
235
236               %n
237                   newline
238
239               %%
240                   a raw %
241
242               %x00
243                   print a byte from a hex code
244
245           •   Placeholders that affect formatting of later placeholders:
246
247               %Cred
248                   switch color to red
249
250               %Cgreen
251                   switch color to green
252
253               %Cblue
254                   switch color to blue
255
256               %Creset
257                   reset color
258
259               %C(...)
260                   color specification, as described under Values in the
261                   "CONFIGURATION FILE" section of git-config(1). By default,
262                   colors are shown only when enabled for log output (by
263                   color.diff, color.ui, or --color, and respecting the auto
264                   settings of the former if we are going to a terminal).
265                   %C(auto,...)  is accepted as a historical synonym for the
266                   default (e.g., %C(auto,red)). Specifying %C(always,...)
267                   will show the colors even when color is not otherwise
268                   enabled (though consider just using --color=always to
269                   enable color for the whole output, including this format
270                   and anything else git might color).  auto alone (i.e.
271                   %C(auto)) will turn on auto coloring on the next
272                   placeholders until the color is switched again.
273
274               %m
275                   left (<), right (>) or boundary (-) mark
276
277               %w([<w>[,<i1>[,<i2>]]])
278                   switch line wrapping, like the -w option of git-
279                   shortlog(1).
280
281               %<(<N>[,trunc|ltrunc|mtrunc])
282                   make the next placeholder take at least N columns, padding
283                   spaces on the right if necessary. Optionally truncate at
284                   the beginning (ltrunc), the middle (mtrunc) or the end
285                   (trunc) if the output is longer than N columns. Note that
286                   truncating only works correctly with N >= 2.
287
288               %<|(<N>)
289                   make the next placeholder take at least until Nth columns,
290                   padding spaces on the right if necessary
291
292               %>(<N>), %>|(<N>)
293                   similar to %<(<N>), %<|(<N>) respectively, but padding
294                   spaces on the left
295
296               %>>(<N>), %>>|(<N>)
297                   similar to %>(<N>), %>|(<N>) respectively, except that if
298                   the next placeholder takes more spaces than given and there
299                   are spaces on its left, use those spaces
300
301               %><(<N>), %><|(<N>)
302                   similar to %<(<N>), %<|(<N>) respectively, but padding both
303                   sides (i.e. the text is centered)
304
305           •   Placeholders that expand to information extracted from the
306               commit:
307
308               %H
309                   commit hash
310
311               %h
312                   abbreviated commit hash
313
314               %T
315                   tree hash
316
317               %t
318                   abbreviated tree hash
319
320               %P
321                   parent hashes
322
323               %p
324                   abbreviated parent hashes
325
326               %an
327                   author name
328
329               %aN
330                   author name (respecting .mailmap, see git-shortlog(1) or
331                   git-blame(1))
332
333               %ae
334                   author email
335
336               %aE
337                   author email (respecting .mailmap, see git-shortlog(1) or
338                   git-blame(1))
339
340               %al
341                   author email local-part (the part before the @ sign)
342
343               %aL
344                   author local-part (see %al) respecting .mailmap, see git-
345                   shortlog(1) or git-blame(1))
346
347               %ad
348                   author date (format respects --date= option)
349
350               %aD
351                   author date, RFC2822 style
352
353               %ar
354                   author date, relative
355
356               %at
357                   author date, UNIX timestamp
358
359               %ai
360                   author date, ISO 8601-like format
361
362               %aI
363                   author date, strict ISO 8601 format
364
365               %as
366                   author date, short format (YYYY-MM-DD)
367
368               %ah
369                   author date, human style (like the --date=human option of
370                   git-rev-list(1))
371
372               %cn
373                   committer name
374
375               %cN
376                   committer name (respecting .mailmap, see git-shortlog(1) or
377                   git-blame(1))
378
379               %ce
380                   committer email
381
382               %cE
383                   committer email (respecting .mailmap, see git-shortlog(1)
384                   or git-blame(1))
385
386               %cl
387                   committer email local-part (the part before the @ sign)
388
389               %cL
390                   committer local-part (see %cl) respecting .mailmap, see
391                   git-shortlog(1) or git-blame(1))
392
393               %cd
394                   committer date (format respects --date= option)
395
396               %cD
397                   committer date, RFC2822 style
398
399               %cr
400                   committer date, relative
401
402               %ct
403                   committer date, UNIX timestamp
404
405               %ci
406                   committer date, ISO 8601-like format
407
408               %cI
409                   committer date, strict ISO 8601 format
410
411               %cs
412                   committer date, short format (YYYY-MM-DD)
413
414               %ch
415                   committer date, human style (like the --date=human option
416                   of git-rev-list(1))
417
418               %d
419                   ref names, like the --decorate option of git-log(1)
420
421               %D
422                   ref names without the " (", ")" wrapping.
423
424               %(describe[:options])
425                   human-readable name, like git-describe(1); empty string for
426                   undescribable commits. The describe string may be followed
427                   by a colon and zero or more comma-separated options.
428                   Descriptions can be inconsistent when tags are added or
429                   removed at the same time.
430
431tags[=<bool-value>]: Instead of only considering
432                       annotated tags, consider lightweight tags as well.
433
434abbrev=<number>: Instead of using the default number of
435                       hexadecimal digits (which will vary according to the
436                       number of objects in the repository with a default of
437                       7) of the abbreviated object name, use <number> digits,
438                       or as many digits as needed to form a unique object
439                       name.
440
441match=<pattern>: Only consider tags matching the given
442                       glob(7) pattern, excluding the "refs/tags/" prefix.
443
444exclude=<pattern>: Do not consider tags matching the
445                       given glob(7) pattern, excluding the "refs/tags/"
446                       prefix.
447
448               %S
449                   ref name given on the command line by which the commit was
450                   reached (like git log --source), only works with git log
451
452               %e
453                   encoding
454
455               %s
456                   subject
457
458               %f
459                   sanitized subject line, suitable for a filename
460
461               %b
462                   body
463
464               %B
465                   raw body (unwrapped subject and body)
466
467               %N
468                   commit notes
469
470               %GG
471                   raw verification message from GPG for a signed commit
472
473               %G?
474                   show "G" for a good (valid) signature, "B" for a bad
475                   signature, "U" for a good signature with unknown validity,
476                   "X" for a good signature that has expired, "Y" for a good
477                   signature made by an expired key, "R" for a good signature
478                   made by a revoked key, "E" if the signature cannot be
479                   checked (e.g. missing key) and "N" for no signature
480
481               %GS
482                   show the name of the signer for a signed commit
483
484               %GK
485                   show the key used to sign a signed commit
486
487               %GF
488                   show the fingerprint of the key used to sign a signed
489                   commit
490
491               %GP
492                   show the fingerprint of the primary key whose subkey was
493                   used to sign a signed commit
494
495               %GT
496                   show the trust level for the key used to sign a signed
497                   commit
498
499               %gD
500                   reflog selector, e.g., refs/stash@{1} or refs/stash@{2
501                   minutes ago}; the format follows the rules described for
502                   the -g option. The portion before the @ is the refname as
503                   given on the command line (so git log -g refs/heads/master
504                   would yield refs/heads/master@{0}).
505
506               %gd
507                   shortened reflog selector; same as %gD, but the refname
508                   portion is shortened for human readability (so
509                   refs/heads/master becomes just master).
510
511               %gn
512                   reflog identity name
513
514               %gN
515                   reflog identity name (respecting .mailmap, see git-
516                   shortlog(1) or git-blame(1))
517
518               %ge
519                   reflog identity email
520
521               %gE
522                   reflog identity email (respecting .mailmap, see git-
523                   shortlog(1) or git-blame(1))
524
525               %gs
526                   reflog subject
527
528               %(trailers[:options])
529                   display the trailers of the body as interpreted by git-
530                   interpret-trailers(1). The trailers string may be followed
531                   by a colon and zero or more comma-separated options. If any
532                   option is provided multiple times the last occurrence wins.
533
534key=<key>: only show trailers with specified <key>.
535                       Matching is done case-insensitively and trailing colon
536                       is optional. If option is given multiple times trailer
537                       lines matching any of the keys are shown. This option
538                       automatically enables the only option so that
539                       non-trailer lines in the trailer block are hidden. If
540                       that is not desired it can be disabled with only=false.
541                       E.g., %(trailers:key=Reviewed-by) shows trailer lines
542                       with key Reviewed-by.
543
544only[=<bool>]: select whether non-trailer lines from
545                       the trailer block should be included.
546
547separator=<sep>: specify a separator inserted between
548                       trailer lines. When this option is not given each
549                       trailer line is terminated with a line feed character.
550                       The string <sep> may contain the literal formatting
551                       codes described above. To use comma as separator one
552                       must use %x2C as it would otherwise be parsed as next
553                       option. E.g., %(trailers:key=Ticket,separator=%x2C )
554                       shows all trailer lines whose key is "Ticket" separated
555                       by a comma and a space.
556
557unfold[=<bool>]: make it behave as if
558                       interpret-trailer’s --unfold option was given. E.g.,
559                       %(trailers:only,unfold=true) unfolds and shows all
560                       trailer lines.
561
562keyonly[=<bool>]: only show the key part of the
563                       trailer.
564
565valueonly[=<bool>]: only show the value part of the
566                       trailer.
567
568key_value_separator=<sep>: specify a separator inserted
569                       between trailer lines. When this option is not given
570                       each trailer key-value pair is separated by ": ".
571                       Otherwise it shares the same semantics as
572                       separator=<sep> above.
573
574           Note
575           Some placeholders may depend on other options given to the revision
576           traversal engine. For example, the %g* reflog options will insert
577           an empty string unless we are traversing reflog entries (e.g., by
578           git log -g). The %d and %D placeholders will use the "short"
579           decoration format if --decorate was not already provided on the
580           command line.
581
582       The boolean options accept an optional value [=<bool-value>]. The
583       values true, false, on, off etc. are all accepted. See the "boolean"
584       sub-section in "EXAMPLES" in git-config(1). If a boolean option is
585       given with no value, it’s enabled.
586
587       If you add a + (plus sign) after % of a placeholder, a line-feed is
588       inserted immediately before the expansion if and only if the
589       placeholder expands to a non-empty string.
590
591       If you add a - (minus sign) after % of a placeholder, all consecutive
592       line-feeds immediately preceding the expansion are deleted if and only
593       if the placeholder expands to an empty string.
594
595       If you add a ` ` (space) after % of a placeholder, a space is inserted
596       immediately before the expansion if and only if the placeholder expands
597       to a non-empty string.
598
599tformat:
600
601           The tformat: format works exactly like format:, except that it
602           provides "terminator" semantics instead of "separator" semantics.
603           In other words, each commit has the message terminator character
604           (usually a newline) appended, rather than a separator placed
605           between entries. This means that the final entry of a single-line
606           format will be properly terminated with a new line, just as the
607           "oneline" format does. For example:
608
609               $ git log -2 --pretty=format:%h 4da45bef \
610                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
611               4da45be
612               7134973 -- NO NEWLINE
613
614               $ git log -2 --pretty=tformat:%h 4da45bef \
615                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
616               4da45be
617               7134973
618
619           In addition, any unrecognized string that has a % in it is
620           interpreted as if it has tformat: in front of it. For example,
621           these two are equivalent:
622
623               $ git log -2 --pretty=tformat:%h 4da45bef
624               $ git log -2 --pretty=%h 4da45bef
625

DIFF FORMATTING

627       The options below can be used to change the way git show generates diff
628       output.
629
630       -p, -u, --patch
631           Generate patch (see section on generating patches).
632
633       -s, --no-patch
634           Suppress diff output. Useful for commands like git show that show
635           the patch by default, or to cancel the effect of --patch.
636
637       --diff-merges=(off|none|on|first-parent|1|separate|m|combined|c|dense-combined|cc|remerge|r),
638       --no-diff-merges
639           Specify diff format to be used for merge commits. Default is
640           `dense-combined` unless --first-parent is in use, in which case
641           first-parent is the default.
642
643           --diff-merges=(off|none), --no-diff-merges
644               Disable output of diffs for merge commits. Useful to override
645               implied value.
646
647           --diff-merges=on, --diff-merges=m, -m
648               This option makes diff output for merge commits to be shown in
649               the default format.  -m will produce the output only if -p is
650               given as well. The default format could be changed using
651               log.diffMerges configuration parameter, which default value is
652               separate.
653
654           --diff-merges=first-parent, --diff-merges=1
655               This option makes merge commits show the full diff with respect
656               to the first parent only.
657
658           --diff-merges=separate
659               This makes merge commits show the full diff with respect to
660               each of the parents. Separate log entry and diff is generated
661               for each parent.
662
663           --diff-merges=remerge, --diff-merges=r, --remerge-diff
664               With this option, two-parent merge commits are remerged to
665               create a temporary tree object — potentially containing files
666               with conflict markers and such. A diff is then shown between
667               that temporary tree and the actual merge commit.
668
669               The output emitted when this option is used is subject to
670               change, and so is its interaction with other options (unless
671               explicitly documented).
672
673           --diff-merges=combined, --diff-merges=c, -c
674               With this option, diff output for a merge commit shows the
675               differences from each of the parents to the merge result
676               simultaneously instead of showing pairwise diff between a
677               parent and the result one at a time. Furthermore, it lists only
678               files which were modified from all parents.  -c implies -p.
679
680           --diff-merges=dense-combined, --diff-merges=cc, --cc
681               With this option the output produced by --diff-merges=combined
682               is further compressed by omitting uninteresting hunks whose
683               contents in the parents have only two variants and the merge
684               result picks one of them without modification.  --cc implies
685               -p.
686
687       --combined-all-paths
688           This flag causes combined diffs (used for merge commits) to list
689           the name of the file from all parents. It thus only has effect when
690           --diff-merges=[dense-]combined is in use, and is likely only useful
691           if filename changes are detected (i.e. when either rename or copy
692           detection have been requested).
693
694       -U<n>, --unified=<n>
695           Generate diffs with <n> lines of context instead of the usual
696           three. Implies --patch.
697
698       --output=<file>
699           Output to a specific file instead of stdout.
700
701       --output-indicator-new=<char>, --output-indicator-old=<char>,
702       --output-indicator-context=<char>
703           Specify the character used to indicate new, old or context lines in
704           the generated patch. Normally they are +, - and ' ' respectively.
705
706       --raw
707           For each commit, show a summary of changes using the raw diff
708           format. See the "RAW OUTPUT FORMAT" section of git-diff(1). This is
709           different from showing the log itself in raw format, which you can
710           achieve with --format=raw.
711
712       --patch-with-raw
713           Synonym for -p --raw.
714
715       -t
716           Show the tree objects in the diff output.
717
718       --indent-heuristic
719           Enable the heuristic that shifts diff hunk boundaries to make
720           patches easier to read. This is the default.
721
722       --no-indent-heuristic
723           Disable the indent heuristic.
724
725       --minimal
726           Spend extra time to make sure the smallest possible diff is
727           produced.
728
729       --patience
730           Generate a diff using the "patience diff" algorithm.
731
732       --histogram
733           Generate a diff using the "histogram diff" algorithm.
734
735       --anchored=<text>
736           Generate a diff using the "anchored diff" algorithm.
737
738           This option may be specified more than once.
739
740           If a line exists in both the source and destination, exists only
741           once, and starts with this text, this algorithm attempts to prevent
742           it from appearing as a deletion or addition in the output. It uses
743           the "patience diff" algorithm internally.
744
745       --diff-algorithm={patience|minimal|histogram|myers}
746           Choose a diff algorithm. The variants are as follows:
747
748           default, myers
749               The basic greedy diff algorithm. Currently, this is the
750               default.
751
752           minimal
753               Spend extra time to make sure the smallest possible diff is
754               produced.
755
756           patience
757               Use "patience diff" algorithm when generating patches.
758
759           histogram
760               This algorithm extends the patience algorithm to "support
761               low-occurrence common elements".
762
763           For instance, if you configured the diff.algorithm variable to a
764           non-default value and want to use the default one, then you have to
765           use --diff-algorithm=default option.
766
767       --stat[=<width>[,<name-width>[,<count>]]]
768           Generate a diffstat. By default, as much space as necessary will be
769           used for the filename part, and the rest for the graph part.
770           Maximum width defaults to terminal width, or 80 columns if not
771           connected to a terminal, and can be overridden by <width>. The
772           width of the filename part can be limited by giving another width
773           <name-width> after a comma. The width of the graph part can be
774           limited by using --stat-graph-width=<width> (affects all commands
775           generating a stat graph) or by setting diff.statGraphWidth=<width>
776           (does not affect git format-patch). By giving a third parameter
777           <count>, you can limit the output to the first <count> lines,
778           followed by ...  if there are more.
779
780           These parameters can also be set individually with
781           --stat-width=<width>, --stat-name-width=<name-width> and
782           --stat-count=<count>.
783
784       --compact-summary
785           Output a condensed summary of extended header information such as
786           file creations or deletions ("new" or "gone", optionally "+l" if
787           it’s a symlink) and mode changes ("+x" or "-x" for adding or
788           removing executable bit respectively) in diffstat. The information
789           is put between the filename part and the graph part. Implies
790           --stat.
791
792       --numstat
793           Similar to --stat, but shows number of added and deleted lines in
794           decimal notation and pathname without abbreviation, to make it more
795           machine friendly. For binary files, outputs two - instead of saying
796           0 0.
797
798       --shortstat
799           Output only the last line of the --stat format containing total
800           number of modified files, as well as number of added and deleted
801           lines.
802
803       -X[<param1,param2,...>], --dirstat[=<param1,param2,...>]
804           Output the distribution of relative amount of changes for each
805           sub-directory. The behavior of --dirstat can be customized by
806           passing it a comma separated list of parameters. The defaults are
807           controlled by the diff.dirstat configuration variable (see git-
808           config(1)). The following parameters are available:
809
810           changes
811               Compute the dirstat numbers by counting the lines that have
812               been removed from the source, or added to the destination. This
813               ignores the amount of pure code movements within a file. In
814               other words, rearranging lines in a file is not counted as much
815               as other changes. This is the default behavior when no
816               parameter is given.
817
818           lines
819               Compute the dirstat numbers by doing the regular line-based
820               diff analysis, and summing the removed/added line counts. (For
821               binary files, count 64-byte chunks instead, since binary files
822               have no natural concept of lines). This is a more expensive
823               --dirstat behavior than the changes behavior, but it does count
824               rearranged lines within a file as much as other changes. The
825               resulting output is consistent with what you get from the other
826               --*stat options.
827
828           files
829               Compute the dirstat numbers by counting the number of files
830               changed. Each changed file counts equally in the dirstat
831               analysis. This is the computationally cheapest --dirstat
832               behavior, since it does not have to look at the file contents
833               at all.
834
835           cumulative
836               Count changes in a child directory for the parent directory as
837               well. Note that when using cumulative, the sum of the
838               percentages reported may exceed 100%. The default
839               (non-cumulative) behavior can be specified with the
840               noncumulative parameter.
841
842           <limit>
843               An integer parameter specifies a cut-off percent (3% by
844               default). Directories contributing less than this percentage of
845               the changes are not shown in the output.
846
847           Example: The following will count changed files, while ignoring
848           directories with less than 10% of the total amount of changed
849           files, and accumulating child directory counts in the parent
850           directories: --dirstat=files,10,cumulative.
851
852       --cumulative
853           Synonym for --dirstat=cumulative
854
855       --dirstat-by-file[=<param1,param2>...]
856           Synonym for --dirstat=files,param1,param2...
857
858       --summary
859           Output a condensed summary of extended header information such as
860           creations, renames and mode changes.
861
862       --patch-with-stat
863           Synonym for -p --stat.
864
865       -z
866           Separate the commits with NULs instead of with new newlines.
867
868           Also, when --raw or --numstat has been given, do not munge
869           pathnames and use NULs as output field terminators.
870
871           Without this option, pathnames with "unusual" characters are quoted
872           as explained for the configuration variable core.quotePath (see
873           git-config(1)).
874
875       --name-only
876           Show only names of changed files. The file names are often encoded
877           in UTF-8. For more information see the discussion about encoding in
878           the git-log(1) manual page.
879
880       --name-status
881           Show only names and status of changed files. See the description of
882           the --diff-filter option on what the status letters mean. Just like
883           --name-only the file names are often encoded in UTF-8.
884
885       --submodule[=<format>]
886           Specify how differences in submodules are shown. When specifying
887           --submodule=short the short format is used. This format just shows
888           the names of the commits at the beginning and end of the range.
889           When --submodule or --submodule=log is specified, the log format is
890           used. This format lists the commits in the range like git-
891           submodule(1) summary does. When --submodule=diff is specified, the
892           diff format is used. This format shows an inline diff of the
893           changes in the submodule contents between the commit range.
894           Defaults to diff.submodule or the short format if the config option
895           is unset.
896
897       --color[=<when>]
898           Show colored diff.  --color (i.e. without =<when>) is the same as
899           --color=always.  <when> can be one of always, never, or auto.
900
901       --no-color
902           Turn off colored diff. It is the same as --color=never.
903
904       --color-moved[=<mode>]
905           Moved lines of code are colored differently. The <mode> defaults to
906           no if the option is not given and to zebra if the option with no
907           mode is given. The mode must be one of:
908
909           no
910               Moved lines are not highlighted.
911
912           default
913               Is a synonym for zebra. This may change to a more sensible mode
914               in the future.
915
916           plain
917               Any line that is added in one location and was removed in
918               another location will be colored with color.diff.newMoved.
919               Similarly color.diff.oldMoved will be used for removed lines
920               that are added somewhere else in the diff. This mode picks up
921               any moved line, but it is not very useful in a review to
922               determine if a block of code was moved without permutation.
923
924           blocks
925               Blocks of moved text of at least 20 alphanumeric characters are
926               detected greedily. The detected blocks are painted using either
927               the color.diff.{old,new}Moved color. Adjacent blocks cannot be
928               told apart.
929
930           zebra
931               Blocks of moved text are detected as in blocks mode. The blocks
932               are painted using either the color.diff.{old,new}Moved color or
933               color.diff.{old,new}MovedAlternative. The change between the
934               two colors indicates that a new block was detected.
935
936           dimmed-zebra
937               Similar to zebra, but additional dimming of uninteresting parts
938               of moved code is performed. The bordering lines of two adjacent
939               blocks are considered interesting, the rest is uninteresting.
940               dimmed_zebra is a deprecated synonym.
941
942       --no-color-moved
943           Turn off move detection. This can be used to override configuration
944           settings. It is the same as --color-moved=no.
945
946       --color-moved-ws=<modes>
947           This configures how whitespace is ignored when performing the move
948           detection for --color-moved. These modes can be given as a comma
949           separated list:
950
951           no
952               Do not ignore whitespace when performing move detection.
953
954           ignore-space-at-eol
955               Ignore changes in whitespace at EOL.
956
957           ignore-space-change
958               Ignore changes in amount of whitespace. This ignores whitespace
959               at line end, and considers all other sequences of one or more
960               whitespace characters to be equivalent.
961
962           ignore-all-space
963               Ignore whitespace when comparing lines. This ignores
964               differences even if one line has whitespace where the other
965               line has none.
966
967           allow-indentation-change
968               Initially ignore any whitespace in the move detection, then
969               group the moved code blocks only into a block if the change in
970               whitespace is the same per line. This is incompatible with the
971               other modes.
972
973       --no-color-moved-ws
974           Do not ignore whitespace when performing move detection. This can
975           be used to override configuration settings. It is the same as
976           --color-moved-ws=no.
977
978       --word-diff[=<mode>]
979           Show a word diff, using the <mode> to delimit changed words. By
980           default, words are delimited by whitespace; see --word-diff-regex
981           below. The <mode> defaults to plain, and must be one of:
982
983           color
984               Highlight changed words using only colors. Implies --color.
985
986           plain
987               Show words as [-removed-] and {+added+}. Makes no attempts to
988               escape the delimiters if they appear in the input, so the
989               output may be ambiguous.
990
991           porcelain
992               Use a special line-based format intended for script
993               consumption. Added/removed/unchanged runs are printed in the
994               usual unified diff format, starting with a +/-/` ` character at
995               the beginning of the line and extending to the end of the line.
996               Newlines in the input are represented by a tilde ~ on a line of
997               its own.
998
999           none
1000               Disable word diff again.
1001
1002           Note that despite the name of the first mode, color is used to
1003           highlight the changed parts in all modes if enabled.
1004
1005       --word-diff-regex=<regex>
1006           Use <regex> to decide what a word is, instead of considering runs
1007           of non-whitespace to be a word. Also implies --word-diff unless it
1008           was already enabled.
1009
1010           Every non-overlapping match of the <regex> is considered a word.
1011           Anything between these matches is considered whitespace and
1012           ignored(!) for the purposes of finding differences. You may want to
1013           append |[^[:space:]] to your regular expression to make sure that
1014           it matches all non-whitespace characters. A match that contains a
1015           newline is silently truncated(!) at the newline.
1016
1017           For example, --word-diff-regex=.  will treat each character as a
1018           word and, correspondingly, show differences character by character.
1019
1020           The regex can also be set via a diff driver or configuration
1021           option, see gitattributes(5) or git-config(1). Giving it explicitly
1022           overrides any diff driver or configuration setting. Diff drivers
1023           override configuration settings.
1024
1025       --color-words[=<regex>]
1026           Equivalent to --word-diff=color plus (if a regex was specified)
1027           --word-diff-regex=<regex>.
1028
1029       --no-renames
1030           Turn off rename detection, even when the configuration file gives
1031           the default to do so.
1032
1033       --[no-]rename-empty
1034           Whether to use empty blobs as rename source.
1035
1036       --check
1037           Warn if changes introduce conflict markers or whitespace errors.
1038           What are considered whitespace errors is controlled by
1039           core.whitespace configuration. By default, trailing whitespaces
1040           (including lines that consist solely of whitespaces) and a space
1041           character that is immediately followed by a tab character inside
1042           the initial indent of the line are considered whitespace errors.
1043           Exits with non-zero status if problems are found. Not compatible
1044           with --exit-code.
1045
1046       --ws-error-highlight=<kind>
1047           Highlight whitespace errors in the context, old or new lines of the
1048           diff. Multiple values are separated by comma, none resets previous
1049           values, default reset the list to new and all is a shorthand for
1050           old,new,context. When this option is not given, and the
1051           configuration variable diff.wsErrorHighlight is not set, only
1052           whitespace errors in new lines are highlighted. The whitespace
1053           errors are colored with color.diff.whitespace.
1054
1055       --full-index
1056           Instead of the first handful of characters, show the full pre- and
1057           post-image blob object names on the "index" line when generating
1058           patch format output.
1059
1060       --binary
1061           In addition to --full-index, output a binary diff that can be
1062           applied with git-apply. Implies --patch.
1063
1064       --abbrev[=<n>]
1065           Instead of showing the full 40-byte hexadecimal object name in
1066           diff-raw format output and diff-tree header lines, show the
1067           shortest prefix that is at least <n> hexdigits long that uniquely
1068           refers the object. In diff-patch output format, --full-index takes
1069           higher precedence, i.e. if --full-index is specified, full blob
1070           names will be shown regardless of --abbrev. Non default number of
1071           digits can be specified with --abbrev=<n>.
1072
1073       -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
1074           Break complete rewrite changes into pairs of delete and create.
1075           This serves two purposes:
1076
1077           It affects the way a change that amounts to a total rewrite of a
1078           file not as a series of deletion and insertion mixed together with
1079           a very few lines that happen to match textually as the context, but
1080           as a single deletion of everything old followed by a single
1081           insertion of everything new, and the number m controls this aspect
1082           of the -B option (defaults to 60%).  -B/70% specifies that less
1083           than 30% of the original should remain in the result for Git to
1084           consider it a total rewrite (i.e. otherwise the resulting patch
1085           will be a series of deletion and insertion mixed together with
1086           context lines).
1087
1088           When used with -M, a totally-rewritten file is also considered as
1089           the source of a rename (usually -M only considers a file that
1090           disappeared as the source of a rename), and the number n controls
1091           this aspect of the -B option (defaults to 50%).  -B20% specifies
1092           that a change with addition and deletion compared to 20% or more of
1093           the file’s size are eligible for being picked up as a possible
1094           source of a rename to another file.
1095
1096       -M[<n>], --find-renames[=<n>]
1097           If generating diffs, detect and report renames for each commit. For
1098           following files across renames while traversing history, see
1099           --follow. If n is specified, it is a threshold on the similarity
1100           index (i.e. amount of addition/deletions compared to the file’s
1101           size). For example, -M90% means Git should consider a delete/add
1102           pair to be a rename if more than 90% of the file hasn’t changed.
1103           Without a % sign, the number is to be read as a fraction, with a
1104           decimal point before it. I.e., -M5 becomes 0.5, and is thus the
1105           same as -M50%. Similarly, -M05 is the same as -M5%. To limit
1106           detection to exact renames, use -M100%. The default similarity
1107           index is 50%.
1108
1109       -C[<n>], --find-copies[=<n>]
1110           Detect copies as well as renames. See also --find-copies-harder. If
1111           n is specified, it has the same meaning as for -M<n>.
1112
1113       --find-copies-harder
1114           For performance reasons, by default, -C option finds copies only if
1115           the original file of the copy was modified in the same changeset.
1116           This flag makes the command inspect unmodified files as candidates
1117           for the source of copy. This is a very expensive operation for
1118           large projects, so use it with caution. Giving more than one -C
1119           option has the same effect.
1120
1121       -D, --irreversible-delete
1122           Omit the preimage for deletes, i.e. print only the header but not
1123           the diff between the preimage and /dev/null. The resulting patch is
1124           not meant to be applied with patch or git apply; this is solely for
1125           people who want to just concentrate on reviewing the text after the
1126           change. In addition, the output obviously lacks enough information
1127           to apply such a patch in reverse, even manually, hence the name of
1128           the option.
1129
1130           When used together with -B, omit also the preimage in the deletion
1131           part of a delete/create pair.
1132
1133       -l<num>
1134           The -M and -C options involve some preliminary steps that can
1135           detect subsets of renames/copies cheaply, followed by an exhaustive
1136           fallback portion that compares all remaining unpaired destinations
1137           to all relevant sources. (For renames, only remaining unpaired
1138           sources are relevant; for copies, all original sources are
1139           relevant.) For N sources and destinations, this exhaustive check is
1140           O(N^2). This option prevents the exhaustive portion of rename/copy
1141           detection from running if the number of source/destination files
1142           involved exceeds the specified number. Defaults to
1143           diff.renameLimit. Note that a value of 0 is treated as unlimited.
1144
1145       --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
1146           Select only files that are Added (A), Copied (C), Deleted (D),
1147           Modified (M), Renamed (R), have their type (i.e. regular file,
1148           symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
1149           (X), or have had their pairing Broken (B). Any combination of the
1150           filter characters (including none) can be used. When *
1151           (All-or-none) is added to the combination, all paths are selected
1152           if there is any file that matches other criteria in the comparison;
1153           if there is no file that matches other criteria, nothing is
1154           selected.
1155
1156           Also, these upper-case letters can be downcased to exclude. E.g.
1157           --diff-filter=ad excludes added and deleted paths.
1158
1159           Note that not all diffs can feature all types. For instance, copied
1160           and renamed entries cannot appear if detection for those types is
1161           disabled.
1162
1163       -S<string>
1164           Look for differences that change the number of occurrences of the
1165           specified string (i.e. addition/deletion) in a file. Intended for
1166           the scripter’s use.
1167
1168           It is useful when you’re looking for an exact block of code (like a
1169           struct), and want to know the history of that block since it first
1170           came into being: use the feature iteratively to feed the
1171           interesting block in the preimage back into -S, and keep going
1172           until you get the very first version of the block.
1173
1174           Binary files are searched as well.
1175
1176       -G<regex>
1177           Look for differences whose patch text contains added/removed lines
1178           that match <regex>.
1179
1180           To illustrate the difference between -S<regex> --pickaxe-regex and
1181           -G<regex>, consider a commit with the following diff in the same
1182           file:
1183
1184               +    return frotz(nitfol, two->ptr, 1, 0);
1185               ...
1186               -    hit = frotz(nitfol, mf2.ptr, 1, 0);
1187
1188           While git log -G"frotz\(nitfol" will show this commit, git log
1189           -S"frotz\(nitfol" --pickaxe-regex will not (because the number of
1190           occurrences of that string did not change).
1191
1192           Unless --text is supplied patches of binary files without a
1193           textconv filter will be ignored.
1194
1195           See the pickaxe entry in gitdiffcore(7) for more information.
1196
1197       --find-object=<object-id>
1198           Look for differences that change the number of occurrences of the
1199           specified object. Similar to -S, just the argument is different in
1200           that it doesn’t search for a specific string but for a specific
1201           object id.
1202
1203           The object can be a blob or a submodule commit. It implies the -t
1204           option in git-log to also find trees.
1205
1206       --pickaxe-all
1207           When -S or -G finds a change, show all the changes in that
1208           changeset, not just the files that contain the change in <string>.
1209
1210       --pickaxe-regex
1211           Treat the <string> given to -S as an extended POSIX regular
1212           expression to match.
1213
1214       -O<orderfile>
1215           Control the order in which files appear in the output. This
1216           overrides the diff.orderFile configuration variable (see git-
1217           config(1)). To cancel diff.orderFile, use -O/dev/null.
1218
1219           The output order is determined by the order of glob patterns in
1220           <orderfile>. All files with pathnames that match the first pattern
1221           are output first, all files with pathnames that match the second
1222           pattern (but not the first) are output next, and so on. All files
1223           with pathnames that do not match any pattern are output last, as if
1224           there was an implicit match-all pattern at the end of the file. If
1225           multiple pathnames have the same rank (they match the same pattern
1226           but no earlier patterns), their output order relative to each other
1227           is the normal order.
1228
1229           <orderfile> is parsed as follows:
1230
1231           •   Blank lines are ignored, so they can be used as separators for
1232               readability.
1233
1234           •   Lines starting with a hash ("#") are ignored, so they can be
1235               used for comments. Add a backslash ("\") to the beginning of
1236               the pattern if it starts with a hash.
1237
1238           •   Each other line contains a single pattern.
1239
1240           Patterns have the same syntax and semantics as patterns used for
1241           fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
1242           matches a pattern if removing any number of the final pathname
1243           components matches the pattern. For example, the pattern "foo*bar"
1244           matches "fooasdfbar" and "foo/bar/baz/asdf" but not "foobarx".
1245
1246       --skip-to=<file>, --rotate-to=<file>
1247           Discard the files before the named <file> from the output (i.e.
1248           skip to), or move them to the end of the output (i.e.  rotate to).
1249           These were invented primarily for use of the git difftool command,
1250           and may not be very useful otherwise.
1251
1252       -R
1253           Swap two inputs; that is, show differences from index or on-disk
1254           file to tree contents.
1255
1256       --relative[=<path>], --no-relative
1257           When run from a subdirectory of the project, it can be told to
1258           exclude changes outside the directory and show pathnames relative
1259           to it with this option. When you are not in a subdirectory (e.g. in
1260           a bare repository), you can name which subdirectory to make the
1261           output relative to by giving a <path> as an argument.
1262           --no-relative can be used to countermand both diff.relative config
1263           option and previous --relative.
1264
1265       -a, --text
1266           Treat all files as text.
1267
1268       --ignore-cr-at-eol
1269           Ignore carriage-return at the end of line when doing a comparison.
1270
1271       --ignore-space-at-eol
1272           Ignore changes in whitespace at EOL.
1273
1274       -b, --ignore-space-change
1275           Ignore changes in amount of whitespace. This ignores whitespace at
1276           line end, and considers all other sequences of one or more
1277           whitespace characters to be equivalent.
1278
1279       -w, --ignore-all-space
1280           Ignore whitespace when comparing lines. This ignores differences
1281           even if one line has whitespace where the other line has none.
1282
1283       --ignore-blank-lines
1284           Ignore changes whose lines are all blank.
1285
1286       -I<regex>, --ignore-matching-lines=<regex>
1287           Ignore changes whose all lines match <regex>. This option may be
1288           specified more than once.
1289
1290       --inter-hunk-context=<lines>
1291           Show the context between diff hunks, up to the specified number of
1292           lines, thereby fusing hunks that are close to each other. Defaults
1293           to diff.interHunkContext or 0 if the config option is unset.
1294
1295       -W, --function-context
1296           Show whole function as context lines for each change. The function
1297           names are determined in the same way as git diff works out patch
1298           hunk headers (see Defining a custom hunk-header in
1299           gitattributes(5)).
1300
1301       --ext-diff
1302           Allow an external diff helper to be executed. If you set an
1303           external diff driver with gitattributes(5), you need to use this
1304           option with git-log(1) and friends.
1305
1306       --no-ext-diff
1307           Disallow external diff drivers.
1308
1309       --textconv, --no-textconv
1310           Allow (or disallow) external text conversion filters to be run when
1311           comparing binary files. See gitattributes(5) for details. Because
1312           textconv filters are typically a one-way conversion, the resulting
1313           diff is suitable for human consumption, but cannot be applied. For
1314           this reason, textconv filters are enabled by default only for git-
1315           diff(1) and git-log(1), but not for git-format-patch(1) or diff
1316           plumbing commands.
1317
1318       --ignore-submodules[=<when>]
1319           Ignore changes to submodules in the diff generation. <when> can be
1320           either "none", "untracked", "dirty" or "all", which is the default.
1321           Using "none" will consider the submodule modified when it either
1322           contains untracked or modified files or its HEAD differs from the
1323           commit recorded in the superproject and can be used to override any
1324           settings of the ignore option in git-config(1) or gitmodules(5).
1325           When "untracked" is used submodules are not considered dirty when
1326           they only contain untracked content (but they are still scanned for
1327           modified content). Using "dirty" ignores all changes to the work
1328           tree of submodules, only changes to the commits stored in the
1329           superproject are shown (this was the behavior until 1.7.0). Using
1330           "all" hides all changes to submodules.
1331
1332       --src-prefix=<prefix>
1333           Show the given source prefix instead of "a/".
1334
1335       --dst-prefix=<prefix>
1336           Show the given destination prefix instead of "b/".
1337
1338       --no-prefix
1339           Do not show any source or destination prefix.
1340
1341       --line-prefix=<prefix>
1342           Prepend an additional prefix to every line of output.
1343
1344       --ita-invisible-in-index
1345           By default entries added by "git add -N" appear as an existing
1346           empty file in "git diff" and a new file in "git diff --cached".
1347           This option makes the entry appear as a new file in "git diff" and
1348           non-existent in "git diff --cached". This option could be reverted
1349           with --ita-visible-in-index. Both options are experimental and
1350           could be removed in future.
1351
1352       For more detailed explanation on these common options, see also
1353       gitdiffcore(7).
1354

GENERATING PATCH TEXT WITH -P

1356       Running git-diff(1), git-log(1), git-show(1), git-diff-index(1), git-
1357       diff-tree(1), or git-diff-files(1) with the -p option produces patch
1358       text. You can customize the creation of patch text via the
1359       GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables (see
1360       git(1)), and the diff attribute (see gitattributes(5)).
1361
1362       What the -p option produces is slightly different from the traditional
1363       diff format:
1364
1365        1. It is preceded with a "git diff" header that looks like this:
1366
1367               diff --git a/file1 b/file2
1368
1369           The a/ and b/ filenames are the same unless rename/copy is
1370           involved. Especially, even for a creation or a deletion, /dev/null
1371           is not used in place of the a/ or b/ filenames.
1372
1373           When rename/copy is involved, file1 and file2 show the name of the
1374           source file of the rename/copy and the name of the file that
1375           rename/copy produces, respectively.
1376
1377        2. It is followed by one or more extended header lines:
1378
1379               old mode <mode>
1380               new mode <mode>
1381               deleted file mode <mode>
1382               new file mode <mode>
1383               copy from <path>
1384               copy to <path>
1385               rename from <path>
1386               rename to <path>
1387               similarity index <number>
1388               dissimilarity index <number>
1389               index <hash>..<hash> <mode>
1390
1391           File modes are printed as 6-digit octal numbers including the file
1392           type and file permission bits.
1393
1394           Path names in extended headers do not include the a/ and b/
1395           prefixes.
1396
1397           The similarity index is the percentage of unchanged lines, and the
1398           dissimilarity index is the percentage of changed lines. It is a
1399           rounded down integer, followed by a percent sign. The similarity
1400           index value of 100% is thus reserved for two equal files, while
1401           100% dissimilarity means that no line from the old file made it
1402           into the new one.
1403
1404           The index line includes the blob object names before and after the
1405           change. The <mode> is included if the file mode does not change;
1406           otherwise, separate lines indicate the old and the new mode.
1407
1408        3. Pathnames with "unusual" characters are quoted as explained for the
1409           configuration variable core.quotePath (see git-config(1)).
1410
1411        4. All the file1 files in the output refer to files before the commit,
1412           and all the file2 files refer to files after the commit. It is
1413           incorrect to apply each change to each file sequentially. For
1414           example, this patch will swap a and b:
1415
1416               diff --git a/a b/b
1417               rename from a
1418               rename to b
1419               diff --git a/b b/a
1420               rename from b
1421               rename to a
1422
1423        5. Hunk headers mention the name of the function to which the hunk
1424           applies. See "Defining a custom hunk-header" in gitattributes(5)
1425           for details of how to tailor to this to specific languages.
1426

COMBINED DIFF FORMAT

1428       Any diff-generating command can take the -c or --cc option to produce a
1429       combined diff when showing a merge. This is the default format when
1430       showing merges with git-diff(1) or git-show(1). Note also that you can
1431       give suitable --diff-merges option to any of these commands to force
1432       generation of diffs in specific format.
1433
1434       A "combined diff" format looks like this:
1435
1436           diff --combined describe.c
1437           index fabadb8,cc95eb0..4866510
1438           --- a/describe.c
1439           +++ b/describe.c
1440           @@@ -98,20 -98,12 +98,20 @@@
1441                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1442             }
1443
1444           - static void describe(char *arg)
1445            -static void describe(struct commit *cmit, int last_one)
1446           ++static void describe(char *arg, int last_one)
1447             {
1448            +      unsigned char sha1[20];
1449            +      struct commit *cmit;
1450                   struct commit_list *list;
1451                   static int initialized = 0;
1452                   struct commit_name *n;
1453
1454            +      if (get_sha1(arg, sha1) < 0)
1455            +              usage(describe_usage);
1456            +      cmit = lookup_commit_reference(sha1);
1457            +      if (!cmit)
1458            +              usage(describe_usage);
1459            +
1460                   if (!initialized) {
1461                           initialized = 1;
1462                           for_each_ref(get_name);
1463
1464        1. It is preceded with a "git diff" header, that looks like this (when
1465           the -c option is used):
1466
1467               diff --combined file
1468
1469           or like this (when the --cc option is used):
1470
1471               diff --cc file
1472
1473        2. It is followed by one or more extended header lines (this example
1474           shows a merge with two parents):
1475
1476               index <hash>,<hash>..<hash>
1477               mode <mode>,<mode>..<mode>
1478               new file mode <mode>
1479               deleted file mode <mode>,<mode>
1480
1481           The mode <mode>,<mode>..<mode> line appears only if at least one of
1482           the <mode> is different from the rest. Extended headers with
1483           information about detected contents movement (renames and copying
1484           detection) are designed to work with diff of two <tree-ish> and are
1485           not used by combined diff format.
1486
1487        3. It is followed by two-line from-file/to-file header
1488
1489               --- a/file
1490               +++ b/file
1491
1492           Similar to two-line header for traditional unified diff format,
1493           /dev/null is used to signal created or deleted files.
1494
1495           However, if the --combined-all-paths option is provided, instead of
1496           a two-line from-file/to-file you get a N+1 line from-file/to-file
1497           header, where N is the number of parents in the merge commit
1498
1499               --- a/file
1500               --- a/file
1501               --- a/file
1502               +++ b/file
1503
1504           This extended format can be useful if rename or copy detection is
1505           active, to allow you to see the original name of the file in
1506           different parents.
1507
1508        4. Chunk header format is modified to prevent people from accidentally
1509           feeding it to patch -p1. Combined diff format was created for
1510           review of merge commit changes, and was not meant to be applied.
1511           The change is similar to the change in the extended index header:
1512
1513               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1514
1515           There are (number of parents + 1) @ characters in the chunk header
1516           for combined diff format.
1517
1518       Unlike the traditional unified diff format, which shows two files A and
1519       B with a single column that has - (minus — appears in A but removed in
1520       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1521       prefix, this format compares two or more files file1, file2,... with
1522       one file X, and shows how X differs from each of fileN. One column for
1523       each of fileN is prepended to the output line to note how X’s line is
1524       different from it.
1525
1526       A - character in the column N means that the line appears in fileN but
1527       it does not appear in the result. A + character in the column N means
1528       that the line appears in the result, and fileN does not have that line
1529       (in other words, the line was added, from the point of view of that
1530       parent).
1531
1532       In the above example output, the function signature was changed from
1533       both files (hence two - removals from both file1 and file2, plus ++ to
1534       mean one line that was added does not appear in either file1 or file2).
1535       Also eight other lines are the same from file1 but do not appear in
1536       file2 (hence prefixed with +).
1537
1538       When shown by git diff-tree -c, it compares the parents of a merge
1539       commit with the merge result (i.e. file1..fileN are the parents). When
1540       shown by git diff-files -c, it compares the two unresolved merge
1541       parents with the working tree file (i.e. file1 is stage 2 aka "our
1542       version", file2 is stage 3 aka "their version").
1543

EXAMPLES

1545       git show v1.0.0
1546           Shows the tag v1.0.0, along with the object the tags points at.
1547
1548       git show v1.0.0^{tree}
1549           Shows the tree pointed to by the tag v1.0.0.
1550
1551       git show -s --format=%s v1.0.0^{commit}
1552           Shows the subject of the commit pointed to by the tag v1.0.0.
1553
1554       git show next~10:Documentation/README
1555           Shows the contents of the file Documentation/README as they were
1556           current in the 10th last commit of the branch next.
1557
1558       git show master:Makefile master:t/Makefile
1559           Concatenates the contents of said Makefiles in the head of the
1560           branch master.
1561

DISCUSSION

1563       Git is to some extent character encoding agnostic.
1564
1565       •   The contents of the blob objects are uninterpreted sequences of
1566           bytes. There is no encoding translation at the core level.
1567
1568       •   Path names are encoded in UTF-8 normalization form C. This applies
1569           to tree objects, the index file, ref names, as well as path names
1570           in command line arguments, environment variables and config files
1571           (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
1572           and gitmodules(5)).
1573
1574           Note that Git at the core level treats path names simply as
1575           sequences of non-NUL bytes, there are no path name encoding
1576           conversions (except on Mac and Windows). Therefore, using non-ASCII
1577           path names will mostly work even on platforms and file systems that
1578           use legacy extended ASCII encodings. However, repositories created
1579           on such systems will not work properly on UTF-8-based systems (e.g.
1580           Linux, Mac, Windows) and vice versa. Additionally, many Git-based
1581           tools simply assume path names to be UTF-8 and will fail to display
1582           other encodings correctly.
1583
1584       •   Commit log messages are typically encoded in UTF-8, but other
1585           extended ASCII encodings are also supported. This includes
1586           ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
1587           CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
1588
1589       Although we encourage that the commit log messages are encoded in
1590       UTF-8, both the core and Git Porcelain are designed not to force UTF-8
1591       on projects. If all participants of a particular project find it more
1592       convenient to use legacy encodings, Git does not forbid it. However,
1593       there are a few things to keep in mind.
1594
1595        1. git commit and git commit-tree issues a warning if the commit log
1596           message given to it does not look like a valid UTF-8 string, unless
1597           you explicitly say your project uses a legacy encoding. The way to
1598           say this is to have i18n.commitEncoding in .git/config file, like
1599           this:
1600
1601               [i18n]
1602                       commitEncoding = ISO-8859-1
1603
1604           Commit objects created with the above setting record the value of
1605           i18n.commitEncoding in its encoding header. This is to help other
1606           people who look at them later. Lack of this header implies that the
1607           commit log message is encoded in UTF-8.
1608
1609        2. git log, git show, git blame and friends look at the encoding
1610           header of a commit object, and try to re-code the log message into
1611           UTF-8 unless otherwise specified. You can specify the desired
1612           output encoding with i18n.logOutputEncoding in .git/config file,
1613           like this:
1614
1615               [i18n]
1616                       logOutputEncoding = ISO-8859-1
1617
1618           If you do not have this configuration variable, the value of
1619           i18n.commitEncoding is used instead.
1620
1621       Note that we deliberately chose not to re-code the commit log message
1622       when a commit is made to force UTF-8 at the commit object level,
1623       because re-coding to UTF-8 is not necessarily a reversible operation.
1624

GIT

1626       Part of the git(1) suite
1627
1628
1629
1630Git 2.36.1                        2022-05-05                       GIT-SHOW(1)
Impressum