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           The commit objects record the encoding used for the log message in
68           their encoding header; this option can be used to tell the command
69           to re-code the commit log message in the encoding preferred by the
70           user. For non plumbing commands this defaults to UTF-8. Note that
71           if an object claims to be encoded in X and we are outputting in X,
72           we will output the object verbatim; this means that invalid
73           sequences in the original commit may be copied to the output.
74
75       --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
76           Perform a tab expansion (replace each tab with enough spaces to
77           fill to the next display column that is multiple of <n>) in the log
78           message before showing it in the output.  --expand-tabs is a
79           short-hand for --expand-tabs=8, and --no-expand-tabs is a
80           short-hand for --expand-tabs=0, which disables tab expansion.
81
82           By default, tabs are expanded in pretty formats that indent the log
83           message by 4 spaces (i.e.  medium, which is the default, full, and
84           fuller).
85
86       --notes[=<ref>]
87           Show the notes (see git-notes(1)) that annotate the commit, when
88           showing the commit log message. This is the default for git log,
89           git show and git whatchanged commands when there is no --pretty,
90           --format, or --oneline option given on the command line.
91
92           By default, the notes shown are from the notes refs listed in the
93           core.notesRef and notes.displayRef variables (or corresponding
94           environment overrides). See git-config(1) for more details.
95
96           With an optional <ref> argument, use the ref to find the notes to
97           display. The ref can specify the full refname when it begins with
98           refs/notes/; when it begins with notes/, refs/ and otherwise
99           refs/notes/ is prefixed to form a full name of the ref.
100
101           Multiple --notes options can be combined to control which notes are
102           being displayed. Examples: "--notes=foo" will show only notes from
103           "refs/notes/foo"; "--notes=foo --notes" will show both notes from
104           "refs/notes/foo" and from the default notes ref(s).
105
106       --no-notes
107           Do not show notes. This negates the above --notes option, by
108           resetting the list of notes refs from which notes are shown.
109           Options are parsed in the order given on the command line, so e.g.
110           "--notes --notes=foo --no-notes --notes=bar" will only show notes
111           from "refs/notes/bar".
112
113       --show-notes[=<ref>], --[no-]standard-notes
114           These options are deprecated. Use the above --notes/--no-notes
115           options instead.
116
117       --show-signature
118           Check the validity of a signed commit object by passing the
119           signature to gpg --verify and show the output.
120

PRETTY FORMATS

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

COMMON DIFF OPTIONS

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

GENERATING PATCH TEXT WITH -P

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

COMBINED DIFF FORMAT

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

EXAMPLES

1426       git show v1.0.0
1427           Shows the tag v1.0.0, along with the object the tags points at.
1428
1429       git show v1.0.0^{tree}
1430           Shows the tree pointed to by the tag v1.0.0.
1431
1432       git show -s --format=%s v1.0.0^{commit}
1433           Shows the subject of the commit pointed to by the tag v1.0.0.
1434
1435       git show next~10:Documentation/README
1436           Shows the contents of the file Documentation/README as they were
1437           current in the 10th last commit of the branch next.
1438
1439       git show master:Makefile master:t/Makefile
1440           Concatenates the contents of said Makefiles in the head of the
1441           branch master.
1442

DISCUSSION

1444       Git is to some extent character encoding agnostic.
1445
1446       ·   The contents of the blob objects are uninterpreted sequences of
1447           bytes. There is no encoding translation at the core level.
1448
1449       ·   Path names are encoded in UTF-8 normalization form C. This applies
1450           to tree objects, the index file, ref names, as well as path names
1451           in command line arguments, environment variables and config files
1452           (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
1453           and gitmodules(5)).
1454
1455           Note that Git at the core level treats path names simply as
1456           sequences of non-NUL bytes, there are no path name encoding
1457           conversions (except on Mac and Windows). Therefore, using non-ASCII
1458           path names will mostly work even on platforms and file systems that
1459           use legacy extended ASCII encodings. However, repositories created
1460           on such systems will not work properly on UTF-8-based systems (e.g.
1461           Linux, Mac, Windows) and vice versa. Additionally, many Git-based
1462           tools simply assume path names to be UTF-8 and will fail to display
1463           other encodings correctly.
1464
1465       ·   Commit log messages are typically encoded in UTF-8, but other
1466           extended ASCII encodings are also supported. This includes
1467           ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
1468           CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
1469
1470       Although we encourage that the commit log messages are encoded in
1471       UTF-8, both the core and Git Porcelain are designed not to force UTF-8
1472       on projects. If all participants of a particular project find it more
1473       convenient to use legacy encodings, Git does not forbid it. However,
1474       there are a few things to keep in mind.
1475
1476        1. git commit and git commit-tree issues a warning if the commit log
1477           message given to it does not look like a valid UTF-8 string, unless
1478           you explicitly say your project uses a legacy encoding. The way to
1479           say this is to have i18n.commitencoding in .git/config file, like
1480           this:
1481
1482               [i18n]
1483                       commitEncoding = ISO-8859-1
1484
1485           Commit objects created with the above setting record the value of
1486           i18n.commitEncoding in its encoding header. This is to help other
1487           people who look at them later. Lack of this header implies that the
1488           commit log message is encoded in UTF-8.
1489
1490        2. git log, git show, git blame and friends look at the encoding
1491           header of a commit object, and try to re-code the log message into
1492           UTF-8 unless otherwise specified. You can specify the desired
1493           output encoding with i18n.logOutputEncoding in .git/config file,
1494           like this:
1495
1496               [i18n]
1497                       logOutputEncoding = ISO-8859-1
1498
1499           If you do not have this configuration variable, the value of
1500           i18n.commitEncoding is used instead.
1501
1502       Note that we deliberately chose not to re-code the commit log message
1503       when a commit is made to force UTF-8 at the commit object level,
1504       because re-coding to UTF-8 is not necessarily a reversible operation.
1505

GIT

1507       Part of the git(1) suite
1508
1509
1510
1511Git 2.30.2                        2021-03-08                       GIT-SHOW(1)
Impressum