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
11

DESCRIPTION

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

OPTIONS

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

PRETTY FORMATS

123       If the commit is a merge, and if the pretty-format is not oneline,
124       email or raw, an additional line is inserted before the Author: line.
125       This line begins with "Merge: " and the sha1s of ancestral commits are
126       printed, separated by spaces. Note that the listed commits may not
127       necessarily be the list of the direct parent commits if you have
128       limited your view of history: for example, if you are only interested
129       in changes related to a certain directory or file.
130
131       There are several built-in formats, and you can define additional
132       formats by setting a pretty.<name> config option to either another
133       format name, or a format: string, as described below (see git-
134       config(1)). Here are the details of the built-in formats:
135
136       ·   oneline
137
138               <sha1> <title line>
139
140           This is designed to be as compact as possible.
141
142       ·   short
143
144               commit <sha1>
145               Author: <author>
146
147               <title line>
148
149       ·   medium
150
151               commit <sha1>
152               Author: <author>
153               Date:   <author date>
154
155               <title line>
156
157               <full commit message>
158
159       ·   full
160
161               commit <sha1>
162               Author: <author>
163               Commit: <committer>
164
165               <title line>
166
167               <full commit message>
168
169       ·   fuller
170
171               commit <sha1>
172               Author:     <author>
173               AuthorDate: <author date>
174               Commit:     <committer>
175               CommitDate: <committer date>
176
177               <title line>
178
179               <full commit message>
180
181       ·   email
182
183               From <sha1> <date>
184               From: <author>
185               Date: <author date>
186               Subject: [PATCH] <title line>
187
188               <full commit message>
189
190       ·   raw
191
192           The raw format shows the entire commit exactly as stored in the
193           commit object. Notably, the SHA-1s are displayed in full,
194           regardless of whether --abbrev or --no-abbrev are used, and parents
195           information show the true parent commits, without taking grafts or
196           history simplification into account. Note that this format affects
197           the way commits are displayed, but not the way the diff is shown
198           e.g. with git log --raw. To get full object names in a raw diff
199           format, use --no-abbrev.
200
201       ·   format:<string>
202
203           The format:<string> format allows you to specify which information
204           you want to show. It works a little bit like printf format, with
205           the notable exception that you get a newline with %n instead of \n.
206
207           E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
208           would show something like this:
209
210               The author of fe6e0ee was Junio C Hamano, 23 hours ago
211               The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
212
213           The placeholders are:
214
215           ·   %H: commit hash
216
217           ·   %h: abbreviated commit hash
218
219           ·   %T: tree hash
220
221           ·   %t: abbreviated tree hash
222
223           ·   %P: parent hashes
224
225           ·   %p: abbreviated parent hashes
226
227           ·   %an: author name
228
229           ·   %aN: author name (respecting .mailmap, see git-shortlog(1) or
230               git-blame(1))
231
232           ·   %ae: author email
233
234           ·   %aE: author email (respecting .mailmap, see git-shortlog(1) or
235               git-blame(1))
236
237           ·   %ad: author date (format respects --date= option)
238
239           ·   %aD: author date, RFC2822 style
240
241           ·   %ar: author date, relative
242
243           ·   %at: author date, UNIX timestamp
244
245           ·   %ai: author date, ISO 8601-like format
246
247           ·   %aI: author date, strict ISO 8601 format
248
249           ·   %cn: committer name
250
251           ·   %cN: committer name (respecting .mailmap, see git-shortlog(1)
252               or git-blame(1))
253
254           ·   %ce: committer email
255
256           ·   %cE: committer email (respecting .mailmap, see git-shortlog(1)
257               or git-blame(1))
258
259           ·   %cd: committer date (format respects --date= option)
260
261           ·   %cD: committer date, RFC2822 style
262
263           ·   %cr: committer date, relative
264
265           ·   %ct: committer date, UNIX timestamp
266
267           ·   %ci: committer date, ISO 8601-like format
268
269           ·   %cI: committer date, strict ISO 8601 format
270
271           ·   %d: ref names, like the --decorate option of git-log(1)
272
273           ·   %D: ref names without the " (", ")" wrapping.
274
275           ·   %S: ref name given on the command line by which the commit was
276               reached (like git log --source), only works with git log
277
278           ·   %e: encoding
279
280           ·   %s: subject
281
282           ·   %f: sanitized subject line, suitable for a filename
283
284           ·   %b: body
285
286           ·   %B: raw body (unwrapped subject and body)
287
288           ·   %N: commit notes
289
290           ·   %GG: raw verification message from GPG for a signed commit
291
292           ·   %G?: show "G" for a good (valid) signature, "B" for a bad
293               signature, "U" for a good signature with unknown validity, "X"
294               for a good signature that has expired, "Y" for a good signature
295               made by an expired key, "R" for a good signature made by a
296               revoked key, "E" if the signature cannot be checked (e.g.
297               missing key) and "N" for no signature
298
299           ·   %GS: show the name of the signer for a signed commit
300
301           ·   %GK: show the key used to sign a signed commit
302
303           ·   %GF: show the fingerprint of the key used to sign a signed
304               commit
305
306           ·   %GP: show the fingerprint of the primary key whose subkey was
307               used to sign a signed commit
308
309           ·   %gD: reflog selector, e.g., refs/stash@{1} or refs/stash@{2
310               minutes ago}; the format follows the rules described for the -g
311               option. The portion before the @ is the refname as given on the
312               command line (so git log -g refs/heads/master would yield
313               refs/heads/master@{0}).
314
315           ·   %gd: shortened reflog selector; same as %gD, but the refname
316               portion is shortened for human readability (so
317               refs/heads/master becomes just master).
318
319           ·   %gn: reflog identity name
320
321           ·   %gN: reflog identity name (respecting .mailmap, see git-
322               shortlog(1) or git-blame(1))
323
324           ·   %ge: reflog identity email
325
326           ·   %gE: reflog identity email (respecting .mailmap, see git-
327               shortlog(1) or git-blame(1))
328
329           ·   %gs: reflog subject
330
331           ·   %Cred: switch color to red
332
333           ·   %Cgreen: switch color to green
334
335           ·   %Cblue: switch color to blue
336
337           ·   %Creset: reset color
338
339           ·   %C(...): color specification, as described under Values in the
340               "CONFIGURATION FILE" section of git-config(1). By default,
341               colors are shown only when enabled for log output (by
342               color.diff, color.ui, or --color, and respecting the auto
343               settings of the former if we are going to a terminal).
344               %C(auto,...)  is accepted as a historical synonym for the
345               default (e.g., %C(auto,red)). Specifying %C(always,...)  will
346               show the colors even when color is not otherwise enabled
347               (though consider just using --color=always to enable color for
348               the whole output, including this format and anything else git
349               might color).  auto alone (i.e.  %C(auto)) will turn on auto
350               coloring on the next placeholders until the color is switched
351               again.
352
353           ·   %m: left (<), right (>) or boundary (-) mark
354
355           ·   %n: newline
356
357           ·   %%: a raw %
358
359           ·   %x00: print a byte from a hex code
360
361           ·   %w([<w>[,<i1>[,<i2>]]]): switch line wrapping, like the -w
362               option of git-shortlog(1).
363
364           ·   %<(<N>[,trunc|ltrunc|mtrunc]): make the next placeholder take
365               at least N columns, padding spaces on the right if necessary.
366               Optionally truncate at the beginning (ltrunc), the middle
367               (mtrunc) or the end (trunc) if the output is longer than N
368               columns. Note that truncating only works correctly with N >= 2.
369
370           ·   %<|(<N>): make the next placeholder take at least until Nth
371               columns, padding spaces on the right if necessary
372
373           ·   %>(<N>), %>|(<N>): similar to %<(<N>), %<|(<N>) respectively,
374               but padding spaces on the left
375
376           ·   %>>(<N>), %>>|(<N>): similar to %>(<N>), %>|(<N>) respectively,
377               except that if the next placeholder takes more spaces than
378               given and there are spaces on its left, use those spaces
379
380           ·   %><(<N>), %><|(<N>): similar to %<(<N>), %<|(<N>) respectively,
381               but padding both sides (i.e. the text is centered)
382
383           ·   %(trailers[:options]): display the trailers of the body as
384               interpreted by git-interpret-trailers(1). The trailers string
385               may be followed by a colon and zero or more comma-separated
386               options. If the only option is given, omit non-trailer lines
387               from the trailer block. If the unfold option is given, behave
388               as if interpret-trailer’s --unfold option was given. E.g.,
389               %(trailers:only,unfold) to do both.
390
391           Note
392           Some placeholders may depend on other options given to the revision
393           traversal engine. For example, the %g* reflog options will insert
394           an empty string unless we are traversing reflog entries (e.g., by
395           git log -g). The %d and %D placeholders will use the "short"
396           decoration format if --decorate was not already provided on the
397           command line.
398
399       If you add a + (plus sign) after % of a placeholder, a line-feed is
400       inserted immediately before the expansion if and only if the
401       placeholder expands to a non-empty string.
402
403       If you add a - (minus sign) after % of a placeholder, all consecutive
404       line-feeds immediately preceding the expansion are deleted if and only
405       if the placeholder expands to an empty string.
406
407       If you add a ` ` (space) after % of a placeholder, a space is inserted
408       immediately before the expansion if and only if the placeholder expands
409       to a non-empty string.
410
411       ·   tformat:
412
413           The tformat: format works exactly like format:, except that it
414           provides "terminator" semantics instead of "separator" semantics.
415           In other words, each commit has the message terminator character
416           (usually a newline) appended, rather than a separator placed
417           between entries. This means that the final entry of a single-line
418           format will be properly terminated with a new line, just as the
419           "oneline" format does. For example:
420
421               $ git log -2 --pretty=format:%h 4da45bef \
422                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
423               4da45be
424               7134973 -- NO NEWLINE
425
426               $ git log -2 --pretty=tformat:%h 4da45bef \
427                 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
428               4da45be
429               7134973
430
431           In addition, any unrecognized string that has a % in it is
432           interpreted as if it has tformat: in front of it. For example,
433           these two are equivalent:
434
435               $ git log -2 --pretty=tformat:%h 4da45bef
436               $ git log -2 --pretty=%h 4da45bef
437
438

COMMON DIFF OPTIONS

440       -p, -u, --patch
441           Generate patch (see section on generating patches).
442
443       -s, --no-patch
444           Suppress diff output. Useful for commands like git show that show
445           the patch by default, or to cancel the effect of --patch.
446
447       -U<n>, --unified=<n>
448           Generate diffs with <n> lines of context instead of the usual
449           three. Implies -p.
450
451       --raw
452           For each commit, show a summary of changes using the raw diff
453           format. See the "RAW OUTPUT FORMAT" section of git-diff(1). This is
454           different from showing the log itself in raw format, which you can
455           achieve with --format=raw.
456
457       --patch-with-raw
458           Synonym for -p --raw.
459
460       --indent-heuristic
461           Enable the heuristic that shifts diff hunk boundaries to make
462           patches easier to read. This is the default.
463
464       --no-indent-heuristic
465           Disable the indent heuristic.
466
467       --minimal
468           Spend extra time to make sure the smallest possible diff is
469           produced.
470
471       --patience
472           Generate a diff using the "patience diff" algorithm.
473
474       --histogram
475           Generate a diff using the "histogram diff" algorithm.
476
477       --anchored=<text>
478           Generate a diff using the "anchored diff" algorithm.
479
480           This option may be specified more than once.
481
482           If a line exists in both the source and destination, exists only
483           once, and starts with this text, this algorithm attempts to prevent
484           it from appearing as a deletion or addition in the output. It uses
485           the "patience diff" algorithm internally.
486
487       --diff-algorithm={patience|minimal|histogram|myers}
488           Choose a diff algorithm. The variants are as follows:
489
490           default, myers
491               The basic greedy diff algorithm. Currently, this is the
492               default.
493
494           minimal
495               Spend extra time to make sure the smallest possible diff is
496               produced.
497
498           patience
499               Use "patience diff" algorithm when generating patches.
500
501           histogram
502               This algorithm extends the patience algorithm to "support
503               low-occurrence common elements".
504
505           For instance, if you configured the diff.algorithm variable to a
506           non-default value and want to use the default one, then you have to
507           use --diff-algorithm=default option.
508
509       --stat[=<width>[,<name-width>[,<count>]]]
510           Generate a diffstat. By default, as much space as necessary will be
511           used for the filename part, and the rest for the graph part.
512           Maximum width defaults to terminal width, or 80 columns if not
513           connected to a terminal, and can be overridden by <width>. The
514           width of the filename part can be limited by giving another width
515           <name-width> after a comma. The width of the graph part can be
516           limited by using --stat-graph-width=<width> (affects all commands
517           generating a stat graph) or by setting diff.statGraphWidth=<width>
518           (does not affect git format-patch). By giving a third parameter
519           <count>, you can limit the output to the first <count> lines,
520           followed by ...  if there are more.
521
522           These parameters can also be set individually with
523           --stat-width=<width>, --stat-name-width=<name-width> and
524           --stat-count=<count>.
525
526       --compact-summary
527           Output a condensed summary of extended header information such as
528           file creations or deletions ("new" or "gone", optionally "+l" if
529           it’s a symlink) and mode changes ("+x" or "-x" for adding or
530           removing executable bit respectively) in diffstat. The information
531           is put between the filename part and the graph part. Implies
532           --stat.
533
534       --numstat
535           Similar to --stat, but shows number of added and deleted lines in
536           decimal notation and pathname without abbreviation, to make it more
537           machine friendly. For binary files, outputs two - instead of saying
538           0 0.
539
540       --shortstat
541           Output only the last line of the --stat format containing total
542           number of modified files, as well as number of added and deleted
543           lines.
544
545       --dirstat[=<param1,param2,...>]
546           Output the distribution of relative amount of changes for each
547           sub-directory. The behavior of --dirstat can be customized by
548           passing it a comma separated list of parameters. The defaults are
549           controlled by the diff.dirstat configuration variable (see git-
550           config(1)). The following parameters are available:
551
552           changes
553               Compute the dirstat numbers by counting the lines that have
554               been removed from the source, or added to the destination. This
555               ignores the amount of pure code movements within a file. In
556               other words, rearranging lines in a file is not counted as much
557               as other changes. This is the default behavior when no
558               parameter is given.
559
560           lines
561               Compute the dirstat numbers by doing the regular line-based
562               diff analysis, and summing the removed/added line counts. (For
563               binary files, count 64-byte chunks instead, since binary files
564               have no natural concept of lines). This is a more expensive
565               --dirstat behavior than the changes behavior, but it does count
566               rearranged lines within a file as much as other changes. The
567               resulting output is consistent with what you get from the other
568               --*stat options.
569
570           files
571               Compute the dirstat numbers by counting the number of files
572               changed. Each changed file counts equally in the dirstat
573               analysis. This is the computationally cheapest --dirstat
574               behavior, since it does not have to look at the file contents
575               at all.
576
577           cumulative
578               Count changes in a child directory for the parent directory as
579               well. Note that when using cumulative, the sum of the
580               percentages reported may exceed 100%. The default
581               (non-cumulative) behavior can be specified with the
582               noncumulative parameter.
583
584           <limit>
585               An integer parameter specifies a cut-off percent (3% by
586               default). Directories contributing less than this percentage of
587               the changes are not shown in the output.
588
589           Example: The following will count changed files, while ignoring
590           directories with less than 10% of the total amount of changed
591           files, and accumulating child directory counts in the parent
592           directories: --dirstat=files,10,cumulative.
593
594       --summary
595           Output a condensed summary of extended header information such as
596           creations, renames and mode changes.
597
598       --patch-with-stat
599           Synonym for -p --stat.
600
601       -z
602           Separate the commits with NULs instead of with new newlines.
603
604           Also, when --raw or --numstat has been given, do not munge
605           pathnames and use NULs as output field terminators.
606
607           Without this option, pathnames with "unusual" characters are quoted
608           as explained for the configuration variable core.quotePath (see
609           git-config(1)).
610
611       --name-only
612           Show only names of changed files.
613
614       --name-status
615           Show only names and status of changed files. See the description of
616           the --diff-filter option on what the status letters mean.
617
618       --submodule[=<format>]
619           Specify how differences in submodules are shown. When specifying
620           --submodule=short the short format is used. This format just shows
621           the names of the commits at the beginning and end of the range.
622           When --submodule or --submodule=log is specified, the log format is
623           used. This format lists the commits in the range like git-
624           submodule(1) summary does. When --submodule=diff is specified, the
625           diff format is used. This format shows an inline diff of the
626           changes in the submodule contents between the commit range.
627           Defaults to diff.submodule or the short format if the config option
628           is unset.
629
630       --color[=<when>]
631           Show colored diff.  --color (i.e. without =<when>) is the same as
632           --color=always.  <when> can be one of always, never, or auto.
633
634       --no-color
635           Turn off colored diff. It is the same as --color=never.
636
637       --color-moved[=<mode>]
638           Moved lines of code are colored differently. The <mode> defaults to
639           no if the option is not given and to zebra if the option with no
640           mode is given. The mode must be one of:
641
642           no
643               Moved lines are not highlighted.
644
645           default
646               Is a synonym for zebra. This may change to a more sensible mode
647               in the future.
648
649           plain
650               Any line that is added in one location and was removed in
651               another location will be colored with color.diff.newMoved.
652               Similarly color.diff.oldMoved will be used for removed lines
653               that are added somewhere else in the diff. This mode picks up
654               any moved line, but it is not very useful in a review to
655               determine if a block of code was moved without permutation.
656
657           blocks
658               Blocks of moved text of at least 20 alphanumeric characters are
659               detected greedily. The detected blocks are painted using either
660               the color.diff.{old,new}Moved color. Adjacent blocks cannot be
661               told apart.
662
663           zebra
664               Blocks of moved text are detected as in blocks mode. The blocks
665               are painted using either the color.diff.{old,new}Moved color or
666               color.diff.{old,new}MovedAlternative. The change between the
667               two colors indicates that a new block was detected.
668
669           dimmed-zebra
670               Similar to zebra, but additional dimming of uninteresting parts
671               of moved code is performed. The bordering lines of two adjacent
672               blocks are considered interesting, the rest is uninteresting.
673               dimmed_zebra is a deprecated synonym.
674
675       --no-color-moved
676           Turn off move detection. This can be used to override configuration
677           settings. It is the same as --color-moved=no.
678
679       --color-moved-ws=<modes>
680           This configures how whitespace is ignored when performing the move
681           detection for --color-moved. These modes can be given as a comma
682           separated list:
683
684           no
685               Do not ignore whitespace when performing move detection.
686
687           ignore-space-at-eol
688               Ignore changes in whitespace at EOL.
689
690           ignore-space-change
691               Ignore changes in amount of whitespace. This ignores whitespace
692               at line end, and considers all other sequences of one or more
693               whitespace characters to be equivalent.
694
695           ignore-all-space
696               Ignore whitespace when comparing lines. This ignores
697               differences even if one line has whitespace where the other
698               line has none.
699
700           allow-indentation-change
701               Initially ignore any whitespace in the move detection, then
702               group the moved code blocks only into a block if the change in
703               whitespace is the same per line. This is incompatible with the
704               other modes.
705
706       --no-color-moved-ws
707           Do not ignore whitespace when performing move detection. This can
708           be used to override configuration settings. It is the same as
709           --color-moved-ws=no.
710
711       --word-diff[=<mode>]
712           Show a word diff, using the <mode> to delimit changed words. By
713           default, words are delimited by whitespace; see --word-diff-regex
714           below. The <mode> defaults to plain, and must be one of:
715
716           color
717               Highlight changed words using only colors. Implies --color.
718
719           plain
720               Show words as [-removed-] and {+added+}. Makes no attempts to
721               escape the delimiters if they appear in the input, so the
722               output may be ambiguous.
723
724           porcelain
725               Use a special line-based format intended for script
726               consumption. Added/removed/unchanged runs are printed in the
727               usual unified diff format, starting with a +/-/` ` character at
728               the beginning of the line and extending to the end of the line.
729               Newlines in the input are represented by a tilde ~ on a line of
730               its own.
731
732           none
733               Disable word diff again.
734
735           Note that despite the name of the first mode, color is used to
736           highlight the changed parts in all modes if enabled.
737
738       --word-diff-regex=<regex>
739           Use <regex> to decide what a word is, instead of considering runs
740           of non-whitespace to be a word. Also implies --word-diff unless it
741           was already enabled.
742
743           Every non-overlapping match of the <regex> is considered a word.
744           Anything between these matches is considered whitespace and
745           ignored(!) for the purposes of finding differences. You may want to
746           append |[^[:space:]] to your regular expression to make sure that
747           it matches all non-whitespace characters. A match that contains a
748           newline is silently truncated(!) at the newline.
749
750           For example, --word-diff-regex=.  will treat each character as a
751           word and, correspondingly, show differences character by character.
752
753           The regex can also be set via a diff driver or configuration
754           option, see gitattributes(5) or git-config(1). Giving it explicitly
755           overrides any diff driver or configuration setting. Diff drivers
756           override configuration settings.
757
758       --color-words[=<regex>]
759           Equivalent to --word-diff=color plus (if a regex was specified)
760           --word-diff-regex=<regex>.
761
762       --no-renames
763           Turn off rename detection, even when the configuration file gives
764           the default to do so.
765
766       --check
767           Warn if changes introduce conflict markers or whitespace errors.
768           What are considered whitespace errors is controlled by
769           core.whitespace configuration. By default, trailing whitespaces
770           (including lines that consist solely of whitespaces) and a space
771           character that is immediately followed by a tab character inside
772           the initial indent of the line are considered whitespace errors.
773           Exits with non-zero status if problems are found. Not compatible
774           with --exit-code.
775
776       --ws-error-highlight=<kind>
777           Highlight whitespace errors in the context, old or new lines of the
778           diff. Multiple values are separated by comma, none resets previous
779           values, default reset the list to new and all is a shorthand for
780           old,new,context. When this option is not given, and the
781           configuration variable diff.wsErrorHighlight is not set, only
782           whitespace errors in new lines are highlighted. The whitespace
783           errors are colored with color.diff.whitespace.
784
785       --full-index
786           Instead of the first handful of characters, show the full pre- and
787           post-image blob object names on the "index" line when generating
788           patch format output.
789
790       --binary
791           In addition to --full-index, output a binary diff that can be
792           applied with git-apply.
793
794       --abbrev[=<n>]
795           Instead of showing the full 40-byte hexadecimal object name in
796           diff-raw format output and diff-tree header lines, show only a
797           partial prefix. This is independent of the --full-index option
798           above, which controls the diff-patch output format. Non default
799           number of digits can be specified with --abbrev=<n>.
800
801       -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
802           Break complete rewrite changes into pairs of delete and create.
803           This serves two purposes:
804
805           It affects the way a change that amounts to a total rewrite of a
806           file not as a series of deletion and insertion mixed together with
807           a very few lines that happen to match textually as the context, but
808           as a single deletion of everything old followed by a single
809           insertion of everything new, and the number m controls this aspect
810           of the -B option (defaults to 60%).  -B/70% specifies that less
811           than 30% of the original should remain in the result for Git to
812           consider it a total rewrite (i.e. otherwise the resulting patch
813           will be a series of deletion and insertion mixed together with
814           context lines).
815
816           When used with -M, a totally-rewritten file is also considered as
817           the source of a rename (usually -M only considers a file that
818           disappeared as the source of a rename), and the number n controls
819           this aspect of the -B option (defaults to 50%).  -B20% specifies
820           that a change with addition and deletion compared to 20% or more of
821           the file’s size are eligible for being picked up as a possible
822           source of a rename to another file.
823
824       -M[<n>], --find-renames[=<n>]
825           If generating diffs, detect and report renames for each commit. For
826           following files across renames while traversing history, see
827           --follow. If n is specified, it is a threshold on the similarity
828           index (i.e. amount of addition/deletions compared to the file’s
829           size). For example, -M90% means Git should consider a delete/add
830           pair to be a rename if more than 90% of the file hasn’t changed.
831           Without a % sign, the number is to be read as a fraction, with a
832           decimal point before it. I.e., -M5 becomes 0.5, and is thus the
833           same as -M50%. Similarly, -M05 is the same as -M5%. To limit
834           detection to exact renames, use -M100%. The default similarity
835           index is 50%.
836
837       -C[<n>], --find-copies[=<n>]
838           Detect copies as well as renames. See also --find-copies-harder. If
839           n is specified, it has the same meaning as for -M<n>.
840
841       --find-copies-harder
842           For performance reasons, by default, -C option finds copies only if
843           the original file of the copy was modified in the same changeset.
844           This flag makes the command inspect unmodified files as candidates
845           for the source of copy. This is a very expensive operation for
846           large projects, so use it with caution. Giving more than one -C
847           option has the same effect.
848
849       -D, --irreversible-delete
850           Omit the preimage for deletes, i.e. print only the header but not
851           the diff between the preimage and /dev/null. The resulting patch is
852           not meant to be applied with patch or git apply; this is solely for
853           people who want to just concentrate on reviewing the text after the
854           change. In addition, the output obviously lacks enough information
855           to apply such a patch in reverse, even manually, hence the name of
856           the option.
857
858           When used together with -B, omit also the preimage in the deletion
859           part of a delete/create pair.
860
861       -l<num>
862           The -M and -C options require O(n^2) processing time where n is the
863           number of potential rename/copy targets. This option prevents
864           rename/copy detection from running if the number of rename/copy
865           targets exceeds the specified number.
866
867       --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
868           Select only files that are Added (A), Copied (C), Deleted (D),
869           Modified (M), Renamed (R), have their type (i.e. regular file,
870           symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
871           (X), or have had their pairing Broken (B). Any combination of the
872           filter characters (including none) can be used. When *
873           (All-or-none) is added to the combination, all paths are selected
874           if there is any file that matches other criteria in the comparison;
875           if there is no file that matches other criteria, nothing is
876           selected.
877
878           Also, these upper-case letters can be downcased to exclude. E.g.
879           --diff-filter=ad excludes added and deleted paths.
880
881           Note that not all diffs can feature all types. For instance, diffs
882           from the index to the working tree can never have Added entries
883           (because the set of paths included in the diff is limited by what
884           is in the index). Similarly, copied and renamed entries cannot
885           appear if detection for those types is disabled.
886
887       -S<string>
888           Look for differences that change the number of occurrences of the
889           specified string (i.e. addition/deletion) in a file. Intended for
890           the scripter’s use.
891
892           It is useful when you’re looking for an exact block of code (like a
893           struct), and want to know the history of that block since it first
894           came into being: use the feature iteratively to feed the
895           interesting block in the preimage back into -S, and keep going
896           until you get the very first version of the block.
897
898           Binary files are searched as well.
899
900       -G<regex>
901           Look for differences whose patch text contains added/removed lines
902           that match <regex>.
903
904           To illustrate the difference between -S<regex> --pickaxe-regex and
905           -G<regex>, consider a commit with the following diff in the same
906           file:
907
908               +    return !regexec(regexp, two->ptr, 1, &regmatch, 0);
909               ...
910               -    hit = !regexec(regexp, mf2.ptr, 1, &regmatch, 0);
911
912           While git log -G"regexec\(regexp" will show this commit, git log
913           -S"regexec\(regexp" --pickaxe-regex will not (because the number of
914           occurrences of that string did not change).
915
916           Unless --text is supplied patches of binary files without a
917           textconv filter will be ignored.
918
919           See the pickaxe entry in gitdiffcore(7) for more information.
920
921       --find-object=<object-id>
922           Look for differences that change the number of occurrences of the
923           specified object. Similar to -S, just the argument is different in
924           that it doesn’t search for a specific string but for a specific
925           object id.
926
927           The object can be a blob or a submodule commit. It implies the -t
928           option in git-log to also find trees.
929
930       --pickaxe-all
931           When -S or -G finds a change, show all the changes in that
932           changeset, not just the files that contain the change in <string>.
933
934       --pickaxe-regex
935           Treat the <string> given to -S as an extended POSIX regular
936           expression to match.
937
938       -O<orderfile>
939           Control the order in which files appear in the output. This
940           overrides the diff.orderFile configuration variable (see git-
941           config(1)). To cancel diff.orderFile, use -O/dev/null.
942
943           The output order is determined by the order of glob patterns in
944           <orderfile>. All files with pathnames that match the first pattern
945           are output first, all files with pathnames that match the second
946           pattern (but not the first) are output next, and so on. All files
947           with pathnames that do not match any pattern are output last, as if
948           there was an implicit match-all pattern at the end of the file. If
949           multiple pathnames have the same rank (they match the same pattern
950           but no earlier patterns), their output order relative to each other
951           is the normal order.
952
953           <orderfile> is parsed as follows:
954
955           ·   Blank lines are ignored, so they can be used as separators for
956               readability.
957
958           ·   Lines starting with a hash ("#") are ignored, so they can be
959               used for comments. Add a backslash ("\") to the beginning of
960               the pattern if it starts with a hash.
961
962           ·   Each other line contains a single pattern.
963
964           Patterns have the same syntax and semantics as patterns used for
965           fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
966           matches a pattern if removing any number of the final pathname
967           components matches the pattern. For example, the pattern "foo*bar"
968           matches "fooasdfbar" and "foo/bar/baz/asdf" but not "foobarx".
969
970       -R
971           Swap two inputs; that is, show differences from index or on-disk
972           file to tree contents.
973
974       --relative[=<path>]
975           When run from a subdirectory of the project, it can be told to
976           exclude changes outside the directory and show pathnames relative
977           to it with this option. When you are not in a subdirectory (e.g. in
978           a bare repository), you can name which subdirectory to make the
979           output relative to by giving a <path> as an argument.
980
981       -a, --text
982           Treat all files as text.
983
984       --ignore-cr-at-eol
985           Ignore carriage-return at the end of line when doing a comparison.
986
987       --ignore-space-at-eol
988           Ignore changes in whitespace at EOL.
989
990       -b, --ignore-space-change
991           Ignore changes in amount of whitespace. This ignores whitespace at
992           line end, and considers all other sequences of one or more
993           whitespace characters to be equivalent.
994
995       -w, --ignore-all-space
996           Ignore whitespace when comparing lines. This ignores differences
997           even if one line has whitespace where the other line has none.
998
999       --ignore-blank-lines
1000           Ignore changes whose lines are all blank.
1001
1002       --inter-hunk-context=<lines>
1003           Show the context between diff hunks, up to the specified number of
1004           lines, thereby fusing hunks that are close to each other. Defaults
1005           to diff.interHunkContext or 0 if the config option is unset.
1006
1007       -W, --function-context
1008           Show whole surrounding functions of changes.
1009
1010       --ext-diff
1011           Allow an external diff helper to be executed. If you set an
1012           external diff driver with gitattributes(5), you need to use this
1013           option with git-log(1) and friends.
1014
1015       --no-ext-diff
1016           Disallow external diff drivers.
1017
1018       --textconv, --no-textconv
1019           Allow (or disallow) external text conversion filters to be run when
1020           comparing binary files. See gitattributes(5) for details. Because
1021           textconv filters are typically a one-way conversion, the resulting
1022           diff is suitable for human consumption, but cannot be applied. For
1023           this reason, textconv filters are enabled by default only for git-
1024           diff(1) and git-log(1), but not for git-format-patch(1) or diff
1025           plumbing commands.
1026
1027       --ignore-submodules[=<when>]
1028           Ignore changes to submodules in the diff generation. <when> can be
1029           either "none", "untracked", "dirty" or "all", which is the default.
1030           Using "none" will consider the submodule modified when it either
1031           contains untracked or modified files or its HEAD differs from the
1032           commit recorded in the superproject and can be used to override any
1033           settings of the ignore option in git-config(1) or gitmodules(5).
1034           When "untracked" is used submodules are not considered dirty when
1035           they only contain untracked content (but they are still scanned for
1036           modified content). Using "dirty" ignores all changes to the work
1037           tree of submodules, only changes to the commits stored in the
1038           superproject are shown (this was the behavior until 1.7.0). Using
1039           "all" hides all changes to submodules.
1040
1041       --src-prefix=<prefix>
1042           Show the given source prefix instead of "a/".
1043
1044       --dst-prefix=<prefix>
1045           Show the given destination prefix instead of "b/".
1046
1047       --no-prefix
1048           Do not show any source or destination prefix.
1049
1050       --line-prefix=<prefix>
1051           Prepend an additional prefix to every line of output.
1052
1053       --ita-invisible-in-index
1054           By default entries added by "git add -N" appear as an existing
1055           empty file in "git diff" and a new file in "git diff --cached".
1056           This option makes the entry appear as a new file in "git diff" and
1057           non-existent in "git diff --cached". This option could be reverted
1058           with --ita-visible-in-index. Both options are experimental and
1059           could be removed in future.
1060
1061       For more detailed explanation on these common options, see also
1062       gitdiffcore(7).
1063

GENERATING PATCHES WITH -P

1065       When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1066       with a -p option, "git diff" without the --raw option, or "git log"
1067       with the "-p" option, they do not produce the output described above;
1068       instead they produce a patch file. You can customize the creation of
1069       such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
1070       environment variables.
1071
1072       What the -p option produces is slightly different from the traditional
1073       diff format:
1074
1075        1. It is preceded with a "git diff" header that looks like this:
1076
1077               diff --git a/file1 b/file2
1078
1079           The a/ and b/ filenames are the same unless rename/copy is
1080           involved. Especially, even for a creation or a deletion, /dev/null
1081           is not used in place of the a/ or b/ filenames.
1082
1083           When rename/copy is involved, file1 and file2 show the name of the
1084           source file of the rename/copy and the name of the file that
1085           rename/copy produces, respectively.
1086
1087        2. It is followed by one or more extended header lines:
1088
1089               old mode <mode>
1090               new mode <mode>
1091               deleted file mode <mode>
1092               new file mode <mode>
1093               copy from <path>
1094               copy to <path>
1095               rename from <path>
1096               rename to <path>
1097               similarity index <number>
1098               dissimilarity index <number>
1099               index <hash>..<hash> <mode>
1100
1101           File modes are printed as 6-digit octal numbers including the file
1102           type and file permission bits.
1103
1104           Path names in extended headers do not include the a/ and b/
1105           prefixes.
1106
1107           The similarity index is the percentage of unchanged lines, and the
1108           dissimilarity index is the percentage of changed lines. It is a
1109           rounded down integer, followed by a percent sign. The similarity
1110           index value of 100% is thus reserved for two equal files, while
1111           100% dissimilarity means that no line from the old file made it
1112           into the new one.
1113
1114           The index line includes the SHA-1 checksum before and after the
1115           change. The <mode> is included if the file mode does not change;
1116           otherwise, separate lines indicate the old and the new mode.
1117
1118        3. Pathnames with "unusual" characters are quoted as explained for the
1119           configuration variable core.quotePath (see git-config(1)).
1120
1121        4. All the file1 files in the output refer to files before the commit,
1122           and all the file2 files refer to files after the commit. It is
1123           incorrect to apply each change to each file sequentially. For
1124           example, this patch will swap a and b:
1125
1126               diff --git a/a b/b
1127               rename from a
1128               rename to b
1129               diff --git a/b b/a
1130               rename from b
1131               rename to a
1132

COMBINED DIFF FORMAT

1134       Any diff-generating command can take the -c or --cc option to produce a
1135       combined diff when showing a merge. This is the default format when
1136       showing merges with git-diff(1) or git-show(1). Note also that you can
1137       give the -m option to any of these commands to force generation of
1138       diffs with individual parents of a merge.
1139
1140       A combined diff format looks like this:
1141
1142           diff --combined describe.c
1143           index fabadb8,cc95eb0..4866510
1144           --- a/describe.c
1145           +++ b/describe.c
1146           @@@ -98,20 -98,12 +98,20 @@@
1147                   return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1148             }
1149
1150           - static void describe(char *arg)
1151            -static void describe(struct commit *cmit, int last_one)
1152           ++static void describe(char *arg, int last_one)
1153             {
1154            +      unsigned char sha1[20];
1155            +      struct commit *cmit;
1156                   struct commit_list *list;
1157                   static int initialized = 0;
1158                   struct commit_name *n;
1159
1160            +      if (get_sha1(arg, sha1) < 0)
1161            +              usage(describe_usage);
1162            +      cmit = lookup_commit_reference(sha1);
1163            +      if (!cmit)
1164            +              usage(describe_usage);
1165            +
1166                   if (!initialized) {
1167                           initialized = 1;
1168                           for_each_ref(get_name);
1169
1170
1171
1172        1. It is preceded with a "git diff" header, that looks like this (when
1173           -c option is used):
1174
1175               diff --combined file
1176
1177           or like this (when --cc option is used):
1178
1179               diff --cc file
1180
1181        2. It is followed by one or more extended header lines (this example
1182           shows a merge with two parents):
1183
1184               index <hash>,<hash>..<hash>
1185               mode <mode>,<mode>..<mode>
1186               new file mode <mode>
1187               deleted file mode <mode>,<mode>
1188
1189           The mode <mode>,<mode>..<mode> line appears only if at least one of
1190           the <mode> is different from the rest. Extended headers with
1191           information about detected contents movement (renames and copying
1192           detection) are designed to work with diff of two <tree-ish> and are
1193           not used by combined diff format.
1194
1195        3. It is followed by two-line from-file/to-file header
1196
1197               --- a/file
1198               +++ b/file
1199
1200           Similar to two-line header for traditional unified diff format,
1201           /dev/null is used to signal created or deleted files.
1202
1203        4. Chunk header format is modified to prevent people from accidentally
1204           feeding it to patch -p1. Combined diff format was created for
1205           review of merge commit changes, and was not meant for apply. The
1206           change is similar to the change in the extended index header:
1207
1208               @@@ <from-file-range> <from-file-range> <to-file-range> @@@
1209
1210           There are (number of parents + 1) @ characters in the chunk header
1211           for combined diff format.
1212
1213       Unlike the traditional unified diff format, which shows two files A and
1214       B with a single column that has - (minus — appears in A but removed in
1215       B), + (plus — missing in A but added to B), or " " (space — unchanged)
1216       prefix, this format compares two or more files file1, file2,... with
1217       one file X, and shows how X differs from each of fileN. One column for
1218       each of fileN is prepended to the output line to note how X’s line is
1219       different from it.
1220
1221       A - character in the column N means that the line appears in fileN but
1222       it does not appear in the result. A + character in the column N means
1223       that the line appears in the result, and fileN does not have that line
1224       (in other words, the line was added, from the point of view of that
1225       parent).
1226
1227       In the above example output, the function signature was changed from
1228       both files (hence two - removals from both file1 and file2, plus ++ to
1229       mean one line that was added does not appear in either file1 or file2).
1230       Also eight other lines are the same from file1 but do not appear in
1231       file2 (hence prefixed with +).
1232
1233       When shown by git diff-tree -c, it compares the parents of a merge
1234       commit with the merge result (i.e. file1..fileN are the parents). When
1235       shown by git diff-files -c, it compares the two unresolved merge
1236       parents with the working tree file (i.e. file1 is stage 2 aka "our
1237       version", file2 is stage 3 aka "their version").
1238

EXAMPLES

1240       git show v1.0.0
1241           Shows the tag v1.0.0, along with the object the tags points at.
1242
1243       git show v1.0.0^{tree}
1244           Shows the tree pointed to by the tag v1.0.0.
1245
1246       git show -s --format=%s v1.0.0^{commit}
1247           Shows the subject of the commit pointed to by the tag v1.0.0.
1248
1249       git show next~10:Documentation/README
1250           Shows the contents of the file Documentation/README as they were
1251           current in the 10th last commit of the branch next.
1252
1253       git show master:Makefile master:t/Makefile
1254           Concatenates the contents of said Makefiles in the head of the
1255           branch master.
1256

DISCUSSION

1258       Git is to some extent character encoding agnostic.
1259
1260       ·   The contents of the blob objects are uninterpreted sequences of
1261           bytes. There is no encoding translation at the core level.
1262
1263       ·   Path names are encoded in UTF-8 normalization form C. This applies
1264           to tree objects, the index file, ref names, as well as path names
1265           in command line arguments, environment variables and config files
1266           (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
1267           and gitmodules(5)).
1268
1269           Note that Git at the core level treats path names simply as
1270           sequences of non-NUL bytes, there are no path name encoding
1271           conversions (except on Mac and Windows). Therefore, using non-ASCII
1272           path names will mostly work even on platforms and file systems that
1273           use legacy extended ASCII encodings. However, repositories created
1274           on such systems will not work properly on UTF-8-based systems (e.g.
1275           Linux, Mac, Windows) and vice versa. Additionally, many Git-based
1276           tools simply assume path names to be UTF-8 and will fail to display
1277           other encodings correctly.
1278
1279       ·   Commit log messages are typically encoded in UTF-8, but other
1280           extended ASCII encodings are also supported. This includes
1281           ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
1282           CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
1283
1284       Although we encourage that the commit log messages are encoded in
1285       UTF-8, both the core and Git Porcelain are designed not to force UTF-8
1286       on projects. If all participants of a particular project find it more
1287       convenient to use legacy encodings, Git does not forbid it. However,
1288       there are a few things to keep in mind.
1289
1290        1. git commit and git commit-tree issues a warning if the commit log
1291           message given to it does not look like a valid UTF-8 string, unless
1292           you explicitly say your project uses a legacy encoding. The way to
1293           say this is to have i18n.commitencoding in .git/config file, like
1294           this:
1295
1296               [i18n]
1297                       commitEncoding = ISO-8859-1
1298
1299           Commit objects created with the above setting record the value of
1300           i18n.commitEncoding in its encoding header. This is to help other
1301           people who look at them later. Lack of this header implies that the
1302           commit log message is encoded in UTF-8.
1303
1304        2. git log, git show, git blame and friends look at the encoding
1305           header of a commit object, and try to re-code the log message into
1306           UTF-8 unless otherwise specified. You can specify the desired
1307           output encoding with i18n.logOutputEncoding in .git/config file,
1308           like this:
1309
1310               [i18n]
1311                       logOutputEncoding = ISO-8859-1
1312
1313           If you do not have this configuration variable, the value of
1314           i18n.commitEncoding is used instead.
1315
1316       Note that we deliberately chose not to re-code the commit log message
1317       when a commit is made to force UTF-8 at the commit object level,
1318       because re-coding to UTF-8 is not necessarily a reversible operation.
1319

GIT

1321       Part of the git(1) suite
1322
1323
1324
1325Git 2.21.0                        02/24/2019                       GIT-SHOW(1)
Impressum