1GIT-LOG(1) Git Manual GIT-LOG(1)
2
3
4
6 git-log - Show commit logs
7
9 git log [<options>] [<revision range>] [[--] <path>...]
10
12 Shows the commit logs.
13
14 The command takes options applicable to the git rev-list command to
15 control what is shown and how, and options applicable to the git diff-*
16 commands to control how the changes each commit introduces are shown.
17
19 --follow
20 Continue listing the history of a file beyond renames (works only
21 for a single file).
22
23 --no-decorate, --decorate[=short|full|auto|no]
24 Print out the ref names of any commits that are shown. If short is
25 specified, the ref name prefixes refs/heads/, refs/tags/ and
26 refs/remotes/ will not be printed. If full is specified, the full
27 ref name (including prefix) will be printed. If auto is specified,
28 then if the output is going to a terminal, the ref names are shown
29 as if short were given, otherwise no ref names are shown. The
30 default option is short.
31
32 --decorate-refs=<pattern>, --decorate-refs-exclude=<pattern>
33 If no --decorate-refs is given, pretend as if all refs were
34 included. For each candidate, do not use it for decoration if it
35 matches any patterns given to --decorate-refs-exclude or if it
36 doesn’t match any of the patterns given to --decorate-refs.
37
38 --source
39 Print out the ref name given on the command line by which each
40 commit was reached.
41
42 --[no-]use-mailmap
43 Use mailmap file to map author and committer names and email
44 addresses to canonical real names and email addresses. See git-
45 shortlog(1).
46
47 --full-diff
48 Without this flag, git log -p <path>... shows commits that touch
49 the specified paths, and diffs about the same specified paths. With
50 this, the full diff is shown for commits that touch the specified
51 paths; this means that "<path>..." limits only commits, and doesn’t
52 limit diff for those commits.
53
54 Note that this affects all diff-based output types, e.g. those
55 produced by --stat, etc.
56
57 --log-size
58 Include a line “log size <number>” in the output for each commit,
59 where <number> is the length of that commit’s message in bytes.
60 Intended to speed up tools that read log messages from git log
61 output by allowing them to allocate space in advance.
62
63 -L <start>,<end>:<file>, -L :<funcname>:<file>
64 Trace the evolution of the line range given by "<start>,<end>" (or
65 the function name regex <funcname>) within the <file>. You may not
66 give any pathspec limiters. This is currently limited to a walk
67 starting from a single revision, i.e., you may only give zero or
68 one positive revision arguments, and <start> and <end> (or
69 <funcname>) must exist in the starting revision. You can specify
70 this option more than once. Implies --patch. Patch output can be
71 suppressed using --no-patch, but other diff formats (namely --raw,
72 --numstat, --shortstat, --dirstat, --summary, --name-only,
73 --name-status, --check) are not currently implemented.
74
75 <start> and <end> can take one of these forms:
76
77 · number
78
79 If <start> or <end> is a number, it specifies an absolute line
80 number (lines count from 1).
81
82 · /regex/
83
84 This form will use the first line matching the given POSIX
85 regex. If <start> is a regex, it will search from the end of
86 the previous -L range, if any, otherwise from the start of
87 file. If <start> is “^/regex/”, it will search from the start
88 of file. If <end> is a regex, it will search starting at the
89 line given by <start>.
90
91 · +offset or -offset
92
93 This is only valid for <end> and will specify a number of lines
94 before or after the line given by <start>.
95
96 If “:<funcname>” is given in place of <start> and <end>, it is a
97 regular expression that denotes the range from the first funcname
98 line that matches <funcname>, up to the next funcname line.
99 “:<funcname>” searches from the end of the previous -L range, if
100 any, otherwise from the start of file. “^:<funcname>” searches
101 from the start of file.
102
103 <revision range>
104 Show only commits in the specified revision range. When no
105 <revision range> is specified, it defaults to HEAD (i.e. the whole
106 history leading to the current commit). origin..HEAD specifies all
107 the commits reachable from the current commit (i.e. HEAD), but not
108 from origin. For a complete list of ways to spell <revision range>,
109 see the Specifying Ranges section of gitrevisions(7).
110
111 [--] <path>...
112 Show only commits that are enough to explain how the files that
113 match the specified paths came to be. See History Simplification
114 below for details and other simplification modes.
115
116 Paths may need to be prefixed with -- to separate them from options
117 or the revision range, when confusion arises.
118
119 Commit Limiting
120 Besides specifying a range of commits that should be listed using the
121 special notations explained in the description, additional commit
122 limiting may be applied.
123
124 Using more options generally further limits the output (e.g.
125 --since=<date1> limits to commits newer than <date1>, and using it with
126 --grep=<pattern> further limits to commits whose log message has a line
127 that matches <pattern>), unless otherwise noted.
128
129 Note that these are applied before commit ordering and formatting
130 options, such as --reverse.
131
132 -<number>, -n <number>, --max-count=<number>
133 Limit the number of commits to output.
134
135 --skip=<number>
136 Skip number commits before starting to show the commit output.
137
138 --since=<date>, --after=<date>
139 Show commits more recent than a specific date.
140
141 --until=<date>, --before=<date>
142 Show commits older than a specific date.
143
144 --author=<pattern>, --committer=<pattern>
145 Limit the commits output to ones with author/committer header lines
146 that match the specified pattern (regular expression). With more
147 than one --author=<pattern>, commits whose author matches any of
148 the given patterns are chosen (similarly for multiple
149 --committer=<pattern>).
150
151 --grep-reflog=<pattern>
152 Limit the commits output to ones with reflog entries that match the
153 specified pattern (regular expression). With more than one
154 --grep-reflog, commits whose reflog message matches any of the
155 given patterns are chosen. It is an error to use this option unless
156 --walk-reflogs is in use.
157
158 --grep=<pattern>
159 Limit the commits output to ones with log message that matches the
160 specified pattern (regular expression). With more than one
161 --grep=<pattern>, commits whose message matches any of the given
162 patterns are chosen (but see --all-match).
163
164 When --notes is in effect, the message from the notes is matched as
165 if it were part of the log message.
166
167 --all-match
168 Limit the commits output to ones that match all given --grep,
169 instead of ones that match at least one.
170
171 --invert-grep
172 Limit the commits output to ones with log message that do not match
173 the pattern specified with --grep=<pattern>.
174
175 -i, --regexp-ignore-case
176 Match the regular expression limiting patterns without regard to
177 letter case.
178
179 --basic-regexp
180 Consider the limiting patterns to be basic regular expressions;
181 this is the default.
182
183 -E, --extended-regexp
184 Consider the limiting patterns to be extended regular expressions
185 instead of the default basic regular expressions.
186
187 -F, --fixed-strings
188 Consider the limiting patterns to be fixed strings (don’t interpret
189 pattern as a regular expression).
190
191 -P, --perl-regexp
192 Consider the limiting patterns to be Perl-compatible regular
193 expressions.
194
195 Support for these types of regular expressions is an optional
196 compile-time dependency. If Git wasn’t compiled with support for
197 them providing this option will cause it to die.
198
199 --remove-empty
200 Stop when a given path disappears from the tree.
201
202 --merges
203 Print only merge commits. This is exactly the same as
204 --min-parents=2.
205
206 --no-merges
207 Do not print commits with more than one parent. This is exactly the
208 same as --max-parents=1.
209
210 --min-parents=<number>, --max-parents=<number>, --no-min-parents,
211 --no-max-parents
212 Show only commits which have at least (or at most) that many parent
213 commits. In particular, --max-parents=1 is the same as --no-merges,
214 --min-parents=2 is the same as --merges. --max-parents=0 gives all
215 root commits and --min-parents=3 all octopus merges.
216
217 --no-min-parents and --no-max-parents reset these limits (to no
218 limit) again. Equivalent forms are --min-parents=0 (any commit has
219 0 or more parents) and --max-parents=-1 (negative numbers denote no
220 upper limit).
221
222 --first-parent
223 Follow only the first parent commit upon seeing a merge commit.
224 This option can give a better overview when viewing the evolution
225 of a particular topic branch, because merges into a topic branch
226 tend to be only about adjusting to updated upstream from time to
227 time, and this option allows you to ignore the individual commits
228 brought in to your history by such a merge. Cannot be combined with
229 --bisect.
230
231 --not
232 Reverses the meaning of the ^ prefix (or lack thereof) for all
233 following revision specifiers, up to the next --not.
234
235 --all
236 Pretend as if all the refs in refs/, along with HEAD, are listed on
237 the command line as <commit>.
238
239 --branches[=<pattern>]
240 Pretend as if all the refs in refs/heads are listed on the command
241 line as <commit>. If <pattern> is given, limit branches to ones
242 matching given shell glob. If pattern lacks ?, *, or [, /* at the
243 end is implied.
244
245 --tags[=<pattern>]
246 Pretend as if all the refs in refs/tags are listed on the command
247 line as <commit>. If <pattern> is given, limit tags to ones
248 matching given shell glob. If pattern lacks ?, *, or [, /* at the
249 end is implied.
250
251 --remotes[=<pattern>]
252 Pretend as if all the refs in refs/remotes are listed on the
253 command line as <commit>. If <pattern> is given, limit
254 remote-tracking branches to ones matching given shell glob. If
255 pattern lacks ?, *, or [, /* at the end is implied.
256
257 --glob=<glob-pattern>
258 Pretend as if all the refs matching shell glob <glob-pattern> are
259 listed on the command line as <commit>. Leading refs/, is
260 automatically prepended if missing. If pattern lacks ?, *, or [, /*
261 at the end is implied.
262
263 --exclude=<glob-pattern>
264 Do not include refs matching <glob-pattern> that the next --all,
265 --branches, --tags, --remotes, or --glob would otherwise consider.
266 Repetitions of this option accumulate exclusion patterns up to the
267 next --all, --branches, --tags, --remotes, or --glob option (other
268 options or arguments do not clear accumulated patterns).
269
270 The patterns given should not begin with refs/heads, refs/tags, or
271 refs/remotes when applied to --branches, --tags, or --remotes,
272 respectively, and they must begin with refs/ when applied to --glob
273 or --all. If a trailing /* is intended, it must be given
274 explicitly.
275
276 --reflog
277 Pretend as if all objects mentioned by reflogs are listed on the
278 command line as <commit>.
279
280 --alternate-refs
281 Pretend as if all objects mentioned as ref tips of alternate
282 repositories were listed on the command line. An alternate
283 repository is any repository whose object directory is specified in
284 objects/info/alternates. The set of included objects may be
285 modified by core.alternateRefsCommand, etc. See git-config(1).
286
287 --single-worktree
288 By default, all working trees will be examined by the following
289 options when there are more than one (see git-worktree(1)): --all,
290 --reflog and --indexed-objects. This option forces them to examine
291 the current working tree only.
292
293 --ignore-missing
294 Upon seeing an invalid object name in the input, pretend as if the
295 bad input was not given.
296
297 --bisect
298 Pretend as if the bad bisection ref refs/bisect/bad was listed and
299 as if it was followed by --not and the good bisection refs
300 refs/bisect/good-* on the command line. Cannot be combined with
301 --first-parent.
302
303 --stdin
304 In addition to the <commit> listed on the command line, read them
305 from the standard input. If a -- separator is seen, stop reading
306 commits and start reading paths to limit the result.
307
308 --cherry-mark
309 Like --cherry-pick (see below) but mark equivalent commits with =
310 rather than omitting them, and inequivalent ones with +.
311
312 --cherry-pick
313 Omit any commit that introduces the same change as another commit
314 on the “other side” when the set of commits are limited with
315 symmetric difference.
316
317 For example, if you have two branches, A and B, a usual way to list
318 all commits on only one side of them is with --left-right (see the
319 example below in the description of the --left-right option).
320 However, it shows the commits that were cherry-picked from the
321 other branch (for example, “3rd on b” may be cherry-picked from
322 branch A). With this option, such pairs of commits are excluded
323 from the output.
324
325 --left-only, --right-only
326 List only commits on the respective side of a symmetric difference,
327 i.e. only those which would be marked < resp. > by --left-right.
328
329 For example, --cherry-pick --right-only A...B omits those commits
330 from B which are in A or are patch-equivalent to a commit in A. In
331 other words, this lists the + commits from git cherry A B. More
332 precisely, --cherry-pick --right-only --no-merges gives the exact
333 list.
334
335 --cherry
336 A synonym for --right-only --cherry-mark --no-merges; useful to
337 limit the output to the commits on our side and mark those that
338 have been applied to the other side of a forked history with git
339 log --cherry upstream...mybranch, similar to git cherry upstream
340 mybranch.
341
342 -g, --walk-reflogs
343 Instead of walking the commit ancestry chain, walk reflog entries
344 from the most recent one to older ones. When this option is used
345 you cannot specify commits to exclude (that is, ^commit,
346 commit1..commit2, and commit1...commit2 notations cannot be used).
347
348 With --pretty format other than oneline and reference (for obvious
349 reasons), this causes the output to have two extra lines of
350 information taken from the reflog. The reflog designator in the
351 output may be shown as ref@{Nth} (where Nth is the
352 reverse-chronological index in the reflog) or as ref@{timestamp}
353 (with the timestamp for that entry), depending on a few rules:
354
355 1. If the starting point is specified as ref@{Nth}, show the index
356 format.
357
358 2. If the starting point was specified as ref@{now}, show the
359 timestamp format.
360
361 3. If neither was used, but --date was given on the command line,
362 show the timestamp in the format requested by --date.
363
364 4. Otherwise, show the index format.
365
366 Under --pretty=oneline, the commit message is prefixed with this
367 information on the same line. This option cannot be combined with
368 --reverse. See also git-reflog(1).
369
370 Under --pretty=reference, this information will not be shown at
371 all.
372
373 --merge
374 After a failed merge, show refs that touch files having a conflict
375 and don’t exist on all heads to merge.
376
377 --boundary
378 Output excluded boundary commits. Boundary commits are prefixed
379 with -.
380
381 History Simplification
382 Sometimes you are only interested in parts of the history, for example
383 the commits modifying a particular <path>. But there are two parts of
384 History Simplification, one part is selecting the commits and the other
385 is how to do it, as there are various strategies to simplify the
386 history.
387
388 The following options select the commits to be shown:
389
390 <paths>
391 Commits modifying the given <paths> are selected.
392
393 --simplify-by-decoration
394 Commits that are referred by some branch or tag are selected.
395
396 Note that extra commits can be shown to give a meaningful history.
397
398 The following options affect the way the simplification is performed:
399
400 Default mode
401 Simplifies the history to the simplest history explaining the final
402 state of the tree. Simplest because it prunes some side branches if
403 the end result is the same (i.e. merging branches with the same
404 content)
405
406 --full-history
407 Same as the default mode, but does not prune some history.
408
409 --dense
410 Only the selected commits are shown, plus some to have a meaningful
411 history.
412
413 --sparse
414 All commits in the simplified history are shown.
415
416 --simplify-merges
417 Additional option to --full-history to remove some needless merges
418 from the resulting history, as there are no selected commits
419 contributing to this merge.
420
421 --ancestry-path
422 When given a range of commits to display (e.g. commit1..commit2 or
423 commit2 ^commit1), only display commits that exist directly on the
424 ancestry chain between the commit1 and commit2, i.e. commits that
425 are both descendants of commit1, and ancestors of commit2.
426
427 A more detailed explanation follows.
428
429 Suppose you specified foo as the <paths>. We shall call commits that
430 modify foo !TREESAME, and the rest TREESAME. (In a diff filtered for
431 foo, they look different and equal, respectively.)
432
433 In the following, we will always refer to the same example history to
434 illustrate the differences between simplification settings. We assume
435 that you are filtering for a file foo in this commit graph:
436
437 .-A---M---N---O---P---Q
438 / / / / / /
439 I B C D E Y
440 \ / / / / /
441 `-------------' X
442
443 The horizontal line of history A---Q is taken to be the first parent of
444 each merge. The commits are:
445
446 · I is the initial commit, in which foo exists with contents “asdf”,
447 and a file quux exists with contents “quux”. Initial commits are
448 compared to an empty tree, so I is !TREESAME.
449
450 · In A, foo contains just “foo”.
451
452 · B contains the same change as A. Its merge M is trivial and hence
453 TREESAME to all parents.
454
455 · C does not change foo, but its merge N changes it to “foobar”, so
456 it is not TREESAME to any parent.
457
458 · D sets foo to “baz”. Its merge O combines the strings from N and D
459 to “foobarbaz”; i.e., it is not TREESAME to any parent.
460
461 · E changes quux to “xyzzy”, and its merge P combines the strings to
462 “quux xyzzy”. P is TREESAME to O, but not to E.
463
464 · X is an independent root commit that added a new file side, and Y
465 modified it. Y is TREESAME to X. Its merge Q added side to P, and
466 Q is TREESAME to P, but not to Y.
467
468 rev-list walks backwards through history, including or excluding
469 commits based on whether --full-history and/or parent rewriting (via
470 --parents or --children) are used. The following settings are
471 available.
472
473 Default mode
474 Commits are included if they are not TREESAME to any parent (though
475 this can be changed, see --sparse below). If the commit was a
476 merge, and it was TREESAME to one parent, follow only that parent.
477 (Even if there are several TREESAME parents, follow only one of
478 them.) Otherwise, follow all parents.
479
480 This results in:
481
482 .-A---N---O
483 / / /
484 I---------D
485
486 Note how the rule to only follow the TREESAME parent, if one is
487 available, removed B from consideration entirely. C was considered
488 via N, but is TREESAME. Root commits are compared to an empty tree,
489 so I is !TREESAME.
490
491 Parent/child relations are only visible with --parents, but that
492 does not affect the commits selected in default mode, so we have
493 shown the parent lines.
494
495 --full-history without parent rewriting
496 This mode differs from the default in one point: always follow all
497 parents of a merge, even if it is TREESAME to one of them. Even if
498 more than one side of the merge has commits that are included, this
499 does not imply that the merge itself is! In the example, we get
500
501 I A B N D O P Q
502
503 M was excluded because it is TREESAME to both parents. E, C and B
504 were all walked, but only B was !TREESAME, so the others do not
505 appear.
506
507 Note that without parent rewriting, it is not really possible to
508 talk about the parent/child relationships between the commits, so
509 we show them disconnected.
510
511 --full-history with parent rewriting
512 Ordinary commits are only included if they are !TREESAME (though
513 this can be changed, see --sparse below).
514
515 Merges are always included. However, their parent list is
516 rewritten: Along each parent, prune away commits that are not
517 included themselves. This results in
518
519 .-A---M---N---O---P---Q
520 / / / / /
521 I B / D /
522 \ / / / /
523 `-------------'
524
525 Compare to --full-history without rewriting above. Note that E was
526 pruned away because it is TREESAME, but the parent list of P was
527 rewritten to contain E's parent I. The same happened for C and N,
528 and X, Y and Q.
529
530 In addition to the above settings, you can change whether TREESAME
531 affects inclusion:
532
533 --dense
534 Commits that are walked are included if they are not TREESAME to
535 any parent.
536
537 --sparse
538 All commits that are walked are included.
539
540 Note that without --full-history, this still simplifies merges: if
541 one of the parents is TREESAME, we follow only that one, so the
542 other sides of the merge are never walked.
543
544 --simplify-merges
545 First, build a history graph in the same way that --full-history
546 with parent rewriting does (see above).
547
548 Then simplify each commit C to its replacement C' in the final
549 history according to the following rules:
550
551 · Set C' to C.
552
553 · Replace each parent P of C' with its simplification P'. In the
554 process, drop parents that are ancestors of other parents or
555 that are root commits TREESAME to an empty tree, and remove
556 duplicates, but take care to never drop all parents that we are
557 TREESAME to.
558
559 · If after this parent rewriting, C' is a root or merge commit
560 (has zero or >1 parents), a boundary commit, or !TREESAME, it
561 remains. Otherwise, it is replaced with its only parent.
562
563 The effect of this is best shown by way of comparing to
564 --full-history with parent rewriting. The example turns into:
565
566 .-A---M---N---O
567 / / /
568 I B D
569 \ / /
570 `---------'
571
572 Note the major differences in N, P, and Q over --full-history:
573
574 · N's parent list had I removed, because it is an ancestor of the
575 other parent M. Still, N remained because it is !TREESAME.
576
577 · P's parent list similarly had I removed. P was then removed
578 completely, because it had one parent and is TREESAME.
579
580 · Q's parent list had Y simplified to X. X was then removed,
581 because it was a TREESAME root. Q was then removed completely,
582 because it had one parent and is TREESAME.
583
584 Finally, there is a fifth simplification mode available:
585
586 --ancestry-path
587 Limit the displayed commits to those directly on the ancestry chain
588 between the “from” and “to” commits in the given commit range. I.e.
589 only display commits that are ancestor of the “to” commit and
590 descendants of the “from” commit.
591
592 As an example use case, consider the following commit history:
593
594 D---E-------F
595 / \ \
596 B---C---G---H---I---J
597 / \
598 A-------K---------------L--M
599
600 A regular D..M computes the set of commits that are ancestors of M,
601 but excludes the ones that are ancestors of D. This is useful to
602 see what happened to the history leading to M since D, in the sense
603 that “what does M have that did not exist in D”. The result in this
604 example would be all the commits, except A and B (and D itself, of
605 course).
606
607 When we want to find out what commits in M are contaminated with
608 the bug introduced by D and need fixing, however, we might want to
609 view only the subset of D..M that are actually descendants of D,
610 i.e. excluding C and K. This is exactly what the --ancestry-path
611 option does. Applied to the D..M range, it results in:
612
613 E-------F
614 \ \
615 G---H---I---J
616 \
617 L--M
618
619 The --simplify-by-decoration option allows you to view only the big
620 picture of the topology of the history, by omitting commits that are
621 not referenced by tags. Commits are marked as !TREESAME (in other
622 words, kept after history simplification rules described above) if (1)
623 they are referenced by tags, or (2) they change the contents of the
624 paths given on the command line. All other commits are marked as
625 TREESAME (subject to be simplified away).
626
627 Commit Ordering
628 By default, the commits are shown in reverse chronological order.
629
630 --date-order
631 Show no parents before all of its children are shown, but otherwise
632 show commits in the commit timestamp order.
633
634 --author-date-order
635 Show no parents before all of its children are shown, but otherwise
636 show commits in the author timestamp order.
637
638 --topo-order
639 Show no parents before all of its children are shown, and avoid
640 showing commits on multiple lines of history intermixed.
641
642 For example, in a commit history like this:
643
644 ---1----2----4----7
645 \ \
646 3----5----6----8---
647
648 where the numbers denote the order of commit timestamps, git
649 rev-list and friends with --date-order show the commits in the
650 timestamp order: 8 7 6 5 4 3 2 1.
651
652 With --topo-order, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
653 3 1); some older commits are shown before newer ones in order to
654 avoid showing the commits from two parallel development track mixed
655 together.
656
657 --reverse
658 Output the commits chosen to be shown (see Commit Limiting section
659 above) in reverse order. Cannot be combined with --walk-reflogs.
660
661 Object Traversal
662 These options are mostly targeted for packing of Git repositories.
663
664 --no-walk[=(sorted|unsorted)]
665 Only show the given commits, but do not traverse their ancestors.
666 This has no effect if a range is specified. If the argument
667 unsorted is given, the commits are shown in the order they were
668 given on the command line. Otherwise (if sorted or no argument was
669 given), the commits are shown in reverse chronological order by
670 commit time. Cannot be combined with --graph.
671
672 --do-walk
673 Overrides a previous --no-walk.
674
675 Commit Formatting
676 --pretty[=<format>], --format=<format>
677 Pretty-print the contents of the commit logs in a given format,
678 where <format> can be one of oneline, short, medium, full, fuller,
679 reference, email, raw, format:<string> and tformat:<string>. When
680 <format> is none of the above, and has %placeholder in it, it acts
681 as if --pretty=tformat:<format> were given.
682
683 See the "PRETTY FORMATS" section for some additional details for
684 each format. When =<format> part is omitted, it defaults to medium.
685
686 Note: you can specify the default pretty format in the repository
687 configuration (see git-config(1)).
688
689 --abbrev-commit
690 Instead of showing the full 40-byte hexadecimal commit object name,
691 show only a partial prefix. Non default number of digits can be
692 specified with "--abbrev=<n>" (which also modifies diff output, if
693 it is displayed).
694
695 This should make "--pretty=oneline" a whole lot more readable for
696 people using 80-column terminals.
697
698 --no-abbrev-commit
699 Show the full 40-byte hexadecimal commit object name. This negates
700 --abbrev-commit and those options which imply it such as
701 "--oneline". It also overrides the log.abbrevCommit variable.
702
703 --oneline
704 This is a shorthand for "--pretty=oneline --abbrev-commit" used
705 together.
706
707 --encoding=<encoding>
708 The commit objects record the encoding used for the log message in
709 their encoding header; this option can be used to tell the command
710 to re-code the commit log message in the encoding preferred by the
711 user. For non plumbing commands this defaults to UTF-8. Note that
712 if an object claims to be encoded in X and we are outputting in X,
713 we will output the object verbatim; this means that invalid
714 sequences in the original commit may be copied to the output.
715
716 --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
717 Perform a tab expansion (replace each tab with enough spaces to
718 fill to the next display column that is multiple of <n>) in the log
719 message before showing it in the output. --expand-tabs is a
720 short-hand for --expand-tabs=8, and --no-expand-tabs is a
721 short-hand for --expand-tabs=0, which disables tab expansion.
722
723 By default, tabs are expanded in pretty formats that indent the log
724 message by 4 spaces (i.e. medium, which is the default, full, and
725 fuller).
726
727 --notes[=<ref>]
728 Show the notes (see git-notes(1)) that annotate the commit, when
729 showing the commit log message. This is the default for git log,
730 git show and git whatchanged commands when there is no --pretty,
731 --format, or --oneline option given on the command line.
732
733 By default, the notes shown are from the notes refs listed in the
734 core.notesRef and notes.displayRef variables (or corresponding
735 environment overrides). See git-config(1) for more details.
736
737 With an optional <ref> argument, use the ref to find the notes to
738 display. The ref can specify the full refname when it begins with
739 refs/notes/; when it begins with notes/, refs/ and otherwise
740 refs/notes/ is prefixed to form a full name of the ref.
741
742 Multiple --notes options can be combined to control which notes are
743 being displayed. Examples: "--notes=foo" will show only notes from
744 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
745 "refs/notes/foo" and from the default notes ref(s).
746
747 --no-notes
748 Do not show notes. This negates the above --notes option, by
749 resetting the list of notes refs from which notes are shown.
750 Options are parsed in the order given on the command line, so e.g.
751 "--notes --notes=foo --no-notes --notes=bar" will only show notes
752 from "refs/notes/bar".
753
754 --show-notes[=<ref>], --[no-]standard-notes
755 These options are deprecated. Use the above --notes/--no-notes
756 options instead.
757
758 --show-signature
759 Check the validity of a signed commit object by passing the
760 signature to gpg --verify and show the output.
761
762 --relative-date
763 Synonym for --date=relative.
764
765 --date=<format>
766 Only takes effect for dates shown in human-readable format, such as
767 when using --pretty. log.date config variable sets a default value
768 for the log command’s --date option. By default, dates are shown in
769 the original time zone (either committer’s or author’s). If -local
770 is appended to the format (e.g., iso-local), the user’s local time
771 zone is used instead.
772
773 --date=relative shows dates relative to the current time, e.g. “2
774 hours ago”. The -local option has no effect for --date=relative.
775
776 --date=local is an alias for --date=default-local.
777
778 --date=iso (or --date=iso8601) shows timestamps in a ISO 8601-like
779 format. The differences to the strict ISO 8601 format are:
780
781 · a space instead of the T date/time delimiter
782
783 · a space between time and time zone
784
785 · no colon between hours and minutes of the time zone
786
787 --date=iso-strict (or --date=iso8601-strict) shows timestamps in
788 strict ISO 8601 format.
789
790 --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format,
791 often found in email messages.
792
793 --date=short shows only the date, but not the time, in YYYY-MM-DD
794 format.
795
796 --date=raw shows the date as seconds since the epoch (1970-01-01
797 00:00:00 UTC), followed by a space, and then the timezone as an
798 offset from UTC (a + or - with four digits; the first two are
799 hours, and the second two are minutes). I.e., as if the timestamp
800 were formatted with strftime("%s %z")). Note that the -local option
801 does not affect the seconds-since-epoch value (which is always
802 measured in UTC), but does switch the accompanying timezone value.
803
804 --date=human shows the timezone if the timezone does not match the
805 current time-zone, and doesn’t print the whole date if that matches
806 (ie skip printing year for dates that are "this year", but also
807 skip the whole date itself if it’s in the last few days and we can
808 just say what weekday it was). For older dates the hour and minute
809 is also omitted.
810
811 --date=unix shows the date as a Unix epoch timestamp (seconds since
812 1970). As with --raw, this is always in UTC and therefore -local
813 has no effect.
814
815 --date=format:... feeds the format ... to your system strftime,
816 except for %z and %Z, which are handled internally. Use
817 --date=format:%c to show the date in your system locale’s preferred
818 format. See the strftime manual for a complete list of format
819 placeholders. When using -local, the correct syntax is
820 --date=format-local:....
821
822 --date=default is the default format, and is similar to
823 --date=rfc2822, with a few exceptions:
824
825 · there is no comma after the day-of-week
826
827 · the time zone is omitted when the local time zone is used
828
829 --parents
830 Print also the parents of the commit (in the form "commit parent...
831 "). Also enables parent rewriting, see History Simplification
832 above.
833
834 --children
835 Print also the children of the commit (in the form "commit child...
836 "). Also enables parent rewriting, see History Simplification
837 above.
838
839 --left-right
840 Mark which side of a symmetric difference a commit is reachable
841 from. Commits from the left side are prefixed with < and those from
842 the right with >. If combined with --boundary, those commits are
843 prefixed with -.
844
845 For example, if you have this topology:
846
847 y---b---b branch B
848 / \ /
849 / .
850 / / \
851 o---x---a---a branch A
852
853 you would get an output like this:
854
855 $ git rev-list --left-right --boundary --pretty=oneline A...B
856
857 >bbbbbbb... 3rd on b
858 >bbbbbbb... 2nd on b
859 <aaaaaaa... 3rd on a
860 <aaaaaaa... 2nd on a
861 -yyyyyyy... 1st on b
862 -xxxxxxx... 1st on a
863
864 --graph
865 Draw a text-based graphical representation of the commit history on
866 the left hand side of the output. This may cause extra lines to be
867 printed in between commits, in order for the graph history to be
868 drawn properly. Cannot be combined with --no-walk.
869
870 This enables parent rewriting, see History Simplification above.
871
872 This implies the --topo-order option by default, but the
873 --date-order option may also be specified.
874
875 --show-linear-break[=<barrier>]
876 When --graph is not used, all history branches are flattened which
877 can make it hard to see that the two consecutive commits do not
878 belong to a linear branch. This option puts a barrier in between
879 them in that case. If <barrier> is specified, it is the string that
880 will be shown instead of the default one.
881
882 Diff Formatting
883 Listed below are options that control the formatting of diff output.
884 Some of them are specific to git-rev-list(1), however other diff
885 options may be given. See git-diff-files(1) for more options.
886
887 -c
888 With this option, diff output for a merge commit shows the
889 differences from each of the parents to the merge result
890 simultaneously instead of showing pairwise diff between a parent
891 and the result one at a time. Furthermore, it lists only files
892 which were modified from all parents.
893
894 --cc
895 This flag implies the -c option and further compresses the patch
896 output by omitting uninteresting hunks whose contents in the
897 parents have only two variants and the merge result picks one of
898 them without modification.
899
900 --combined-all-paths
901 This flag causes combined diffs (used for merge commits) to list
902 the name of the file from all parents. It thus only has effect when
903 -c or --cc are specified, and is likely only useful if filename
904 changes are detected (i.e. when either rename or copy detection
905 have been requested).
906
907 -m
908 This flag makes the merge commits show the full diff like regular
909 commits; for each merge parent, a separate log entry and diff is
910 generated. An exception is that only diff against the first parent
911 is shown when --first-parent option is given; in that case, the
912 output represents the changes the merge brought into the
913 then-current branch.
914
915 -r
916 Show recursive diffs.
917
918 -t
919 Show the tree objects in the diff output. This implies -r.
920
922 If the commit is a merge, and if the pretty-format is not oneline,
923 email or raw, an additional line is inserted before the Author: line.
924 This line begins with "Merge: " and the hashes of ancestral commits are
925 printed, separated by spaces. Note that the listed commits may not
926 necessarily be the list of the direct parent commits if you have
927 limited your view of history: for example, if you are only interested
928 in changes related to a certain directory or file.
929
930 There are several built-in formats, and you can define additional
931 formats by setting a pretty.<name> config option to either another
932 format name, or a format: string, as described below (see git-
933 config(1)). Here are the details of the built-in formats:
934
935 · oneline
936
937 <hash> <title line>
938
939 This is designed to be as compact as possible.
940
941 · short
942
943 commit <hash>
944 Author: <author>
945
946 <title line>
947
948 · medium
949
950 commit <hash>
951 Author: <author>
952 Date: <author date>
953
954 <title line>
955
956 <full commit message>
957
958 · full
959
960 commit <hash>
961 Author: <author>
962 Commit: <committer>
963
964 <title line>
965
966 <full commit message>
967
968 · fuller
969
970 commit <hash>
971 Author: <author>
972 AuthorDate: <author date>
973 Commit: <committer>
974 CommitDate: <committer date>
975
976 <title line>
977
978 <full commit message>
979
980 · reference
981
982 <abbrev hash> (<title line>, <short author date>)
983
984 This format is used to refer to another commit in a commit message
985 and is the same as --pretty='format:%C(auto)%h (%s, %ad)'. By
986 default, the date is formatted with --date=short unless another
987 --date option is explicitly specified. As with any format: with
988 format placeholders, its output is not affected by other options
989 like --decorate and --walk-reflogs.
990
991 · email
992
993 From <hash> <date>
994 From: <author>
995 Date: <author date>
996 Subject: [PATCH] <title line>
997
998 <full commit message>
999
1000 · raw
1001
1002 The raw format shows the entire commit exactly as stored in the
1003 commit object. Notably, the hashes are displayed in full,
1004 regardless of whether --abbrev or --no-abbrev are used, and parents
1005 information show the true parent commits, without taking grafts or
1006 history simplification into account. Note that this format affects
1007 the way commits are displayed, but not the way the diff is shown
1008 e.g. with git log --raw. To get full object names in a raw diff
1009 format, use --no-abbrev.
1010
1011 · format:<string>
1012
1013 The format:<string> format allows you to specify which information
1014 you want to show. It works a little bit like printf format, with
1015 the notable exception that you get a newline with %n instead of \n.
1016
1017 E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
1018 would show something like this:
1019
1020 The author of fe6e0ee was Junio C Hamano, 23 hours ago
1021 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
1022
1023 The placeholders are:
1024
1025 · Placeholders that expand to a single literal character:
1026
1027 %n
1028 newline
1029
1030 %%
1031 a raw %
1032
1033 %x00
1034 print a byte from a hex code
1035
1036 · Placeholders that affect formatting of later placeholders:
1037
1038 %Cred
1039 switch color to red
1040
1041 %Cgreen
1042 switch color to green
1043
1044 %Cblue
1045 switch color to blue
1046
1047 %Creset
1048 reset color
1049
1050 %C(...)
1051 color specification, as described under Values in the
1052 "CONFIGURATION FILE" section of git-config(1). By default,
1053 colors are shown only when enabled for log output (by
1054 color.diff, color.ui, or --color, and respecting the auto
1055 settings of the former if we are going to a terminal).
1056 %C(auto,...) is accepted as a historical synonym for the
1057 default (e.g., %C(auto,red)). Specifying %C(always,...)
1058 will show the colors even when color is not otherwise
1059 enabled (though consider just using --color=always to
1060 enable color for the whole output, including this format
1061 and anything else git might color). auto alone (i.e.
1062 %C(auto)) will turn on auto coloring on the next
1063 placeholders until the color is switched again.
1064
1065 %m
1066 left (<), right (>) or boundary (-) mark
1067
1068 %w([<w>[,<i1>[,<i2>]]])
1069 switch line wrapping, like the -w option of git-
1070 shortlog(1).
1071
1072 %<(<N>[,trunc|ltrunc|mtrunc])
1073 make the next placeholder take at least N columns, padding
1074 spaces on the right if necessary. Optionally truncate at
1075 the beginning (ltrunc), the middle (mtrunc) or the end
1076 (trunc) if the output is longer than N columns. Note that
1077 truncating only works correctly with N >= 2.
1078
1079 %<|(<N>)
1080 make the next placeholder take at least until Nth columns,
1081 padding spaces on the right if necessary
1082
1083 %>(<N>), %>|(<N>)
1084 similar to %<(<N>), %<|(<N>) respectively, but padding
1085 spaces on the left
1086
1087 %>>(<N>), %>>|(<N>)
1088 similar to %>(<N>), %>|(<N>) respectively, except that if
1089 the next placeholder takes more spaces than given and there
1090 are spaces on its left, use those spaces
1091
1092 %><(<N>), %><|(<N>)
1093 similar to %<(<N>), %<|(<N>) respectively, but padding both
1094 sides (i.e. the text is centered)
1095
1096 · Placeholders that expand to information extracted from the
1097 commit:
1098
1099 %H
1100 commit hash
1101
1102 %h
1103 abbreviated commit hash
1104
1105 %T
1106 tree hash
1107
1108 %t
1109 abbreviated tree hash
1110
1111 %P
1112 parent hashes
1113
1114 %p
1115 abbreviated parent hashes
1116
1117 %an
1118 author name
1119
1120 %aN
1121 author name (respecting .mailmap, see git-shortlog(1) or
1122 git-blame(1))
1123
1124 %ae
1125 author email
1126
1127 %aE
1128 author email (respecting .mailmap, see git-shortlog(1) or
1129 git-blame(1))
1130
1131 %al
1132 author email local-part (the part before the @ sign)
1133
1134 %aL
1135 author local-part (see %al) respecting .mailmap, see git-
1136 shortlog(1) or git-blame(1))
1137
1138 %ad
1139 author date (format respects --date= option)
1140
1141 %aD
1142 author date, RFC2822 style
1143
1144 %ar
1145 author date, relative
1146
1147 %at
1148 author date, UNIX timestamp
1149
1150 %ai
1151 author date, ISO 8601-like format
1152
1153 %aI
1154 author date, strict ISO 8601 format
1155
1156 %as
1157 author date, short format (YYYY-MM-DD)
1158
1159 %cn
1160 committer name
1161
1162 %cN
1163 committer name (respecting .mailmap, see git-shortlog(1) or
1164 git-blame(1))
1165
1166 %ce
1167 committer email
1168
1169 %cE
1170 committer email (respecting .mailmap, see git-shortlog(1)
1171 or git-blame(1))
1172
1173 %cl
1174 author email local-part (the part before the @ sign)
1175
1176 %cL
1177 author local-part (see %cl) respecting .mailmap, see git-
1178 shortlog(1) or git-blame(1))
1179
1180 %cd
1181 committer date (format respects --date= option)
1182
1183 %cD
1184 committer date, RFC2822 style
1185
1186 %cr
1187 committer date, relative
1188
1189 %ct
1190 committer date, UNIX timestamp
1191
1192 %ci
1193 committer date, ISO 8601-like format
1194
1195 %cI
1196 committer date, strict ISO 8601 format
1197
1198 %cs
1199 committer date, short format (YYYY-MM-DD)
1200
1201 %d
1202 ref names, like the --decorate option of git-log(1)
1203
1204 %D
1205 ref names without the " (", ")" wrapping.
1206
1207 %S
1208 ref name given on the command line by which the commit was
1209 reached (like git log --source), only works with git log
1210
1211 %e
1212 encoding
1213
1214 %s
1215 subject
1216
1217 %f
1218 sanitized subject line, suitable for a filename
1219
1220 %b
1221 body
1222
1223 %B
1224 raw body (unwrapped subject and body)
1225
1226 %N
1227 commit notes
1228
1229 %GG
1230 raw verification message from GPG for a signed commit
1231
1232 %G?
1233 show "G" for a good (valid) signature, "B" for a bad
1234 signature, "U" for a good signature with unknown validity,
1235 "X" for a good signature that has expired, "Y" for a good
1236 signature made by an expired key, "R" for a good signature
1237 made by a revoked key, "E" if the signature cannot be
1238 checked (e.g. missing key) and "N" for no signature
1239
1240 %GS
1241 show the name of the signer for a signed commit
1242
1243 %GK
1244 show the key used to sign a signed commit
1245
1246 %GF
1247 show the fingerprint of the key used to sign a signed
1248 commit
1249
1250 %GP
1251 show the fingerprint of the primary key whose subkey was
1252 used to sign a signed commit
1253
1254 %GT
1255 show the trust level for the key used to sign a signed
1256 commit
1257
1258 %gD
1259 reflog selector, e.g., refs/stash@{1} or refs/stash@{2
1260 minutes ago}; the format follows the rules described for
1261 the -g option. The portion before the @ is the refname as
1262 given on the command line (so git log -g refs/heads/master
1263 would yield refs/heads/master@{0}).
1264
1265 %gd
1266 shortened reflog selector; same as %gD, but the refname
1267 portion is shortened for human readability (so
1268 refs/heads/master becomes just master).
1269
1270 %gn
1271 reflog identity name
1272
1273 %gN
1274 reflog identity name (respecting .mailmap, see git-
1275 shortlog(1) or git-blame(1))
1276
1277 %ge
1278 reflog identity email
1279
1280 %gE
1281 reflog identity email (respecting .mailmap, see git-
1282 shortlog(1) or git-blame(1))
1283
1284 %gs
1285 reflog subject
1286
1287 %(trailers[:options])
1288 display the trailers of the body as interpreted by git-
1289 interpret-trailers(1). The trailers string may be followed
1290 by a colon and zero or more comma-separated options:
1291
1292 · key=<K>: only show trailers with specified key.
1293 Matching is done case-insensitively and trailing colon
1294 is optional. If option is given multiple times trailer
1295 lines matching any of the keys are shown. This option
1296 automatically enables the only option so that
1297 non-trailer lines in the trailer block are hidden. If
1298 that is not desired it can be disabled with only=false.
1299 E.g., %(trailers:key=Reviewed-by) shows trailer lines
1300 with key Reviewed-by.
1301
1302 · only[=val]: select whether non-trailer lines from the
1303 trailer block should be included. The only keyword may
1304 optionally be followed by an equal sign and one of
1305 true, on, yes to omit or false, off, no to show the
1306 non-trailer lines. If option is given without value it
1307 is enabled. If given multiple times the last value is
1308 used.
1309
1310 · separator=<SEP>: specify a separator inserted between
1311 trailer lines. When this option is not given each
1312 trailer line is terminated with a line feed character.
1313 The string SEP may contain the literal formatting codes
1314 described above. To use comma as separator one must use
1315 %x2C as it would otherwise be parsed as next option. If
1316 separator option is given multiple times only the last
1317 one is used. E.g., %(trailers:key=Ticket,separator=%x2C
1318 ) shows all trailer lines whose key is "Ticket"
1319 separated by a comma and a space.
1320
1321 · unfold[=val]: make it behave as if interpret-trailer’s
1322 --unfold option was given. In same way as to for only
1323 it can be followed by an equal sign and explicit value.
1324 E.g., %(trailers:only,unfold=true) unfolds and shows
1325 all trailer lines.
1326
1327 · valueonly[=val]: skip over the key part of the trailer
1328 line and only show the value part. Also this optionally
1329 allows explicit value.
1330
1331 Note
1332 Some placeholders may depend on other options given to the revision
1333 traversal engine. For example, the %g* reflog options will insert
1334 an empty string unless we are traversing reflog entries (e.g., by
1335 git log -g). The %d and %D placeholders will use the "short"
1336 decoration format if --decorate was not already provided on the
1337 command line.
1338
1339 If you add a + (plus sign) after % of a placeholder, a line-feed is
1340 inserted immediately before the expansion if and only if the
1341 placeholder expands to a non-empty string.
1342
1343 If you add a - (minus sign) after % of a placeholder, all consecutive
1344 line-feeds immediately preceding the expansion are deleted if and only
1345 if the placeholder expands to an empty string.
1346
1347 If you add a ` ` (space) after % of a placeholder, a space is inserted
1348 immediately before the expansion if and only if the placeholder expands
1349 to a non-empty string.
1350
1351 · tformat:
1352
1353 The tformat: format works exactly like format:, except that it
1354 provides "terminator" semantics instead of "separator" semantics.
1355 In other words, each commit has the message terminator character
1356 (usually a newline) appended, rather than a separator placed
1357 between entries. This means that the final entry of a single-line
1358 format will be properly terminated with a new line, just as the
1359 "oneline" format does. For example:
1360
1361 $ git log -2 --pretty=format:%h 4da45bef \
1362 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1363 4da45be
1364 7134973 -- NO NEWLINE
1365
1366 $ git log -2 --pretty=tformat:%h 4da45bef \
1367 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1368 4da45be
1369 7134973
1370
1371 In addition, any unrecognized string that has a % in it is
1372 interpreted as if it has tformat: in front of it. For example,
1373 these two are equivalent:
1374
1375 $ git log -2 --pretty=tformat:%h 4da45bef
1376 $ git log -2 --pretty=%h 4da45bef
1377
1379 -p, -u, --patch
1380 Generate patch (see section on generating patches).
1381
1382 -s, --no-patch
1383 Suppress diff output. Useful for commands like git show that show
1384 the patch by default, or to cancel the effect of --patch.
1385
1386 -U<n>, --unified=<n>
1387 Generate diffs with <n> lines of context instead of the usual
1388 three. Implies --patch. Implies -p.
1389
1390 --output=<file>
1391 Output to a specific file instead of stdout.
1392
1393 --output-indicator-new=<char>, --output-indicator-old=<char>,
1394 --output-indicator-context=<char>
1395 Specify the character used to indicate new, old or context lines in
1396 the generated patch. Normally they are +, - and ' ' respectively.
1397
1398 --raw
1399 For each commit, show a summary of changes using the raw diff
1400 format. See the "RAW OUTPUT FORMAT" section of git-diff(1). This is
1401 different from showing the log itself in raw format, which you can
1402 achieve with --format=raw.
1403
1404 --patch-with-raw
1405 Synonym for -p --raw.
1406
1407 --indent-heuristic
1408 Enable the heuristic that shifts diff hunk boundaries to make
1409 patches easier to read. This is the default.
1410
1411 --no-indent-heuristic
1412 Disable the indent heuristic.
1413
1414 --minimal
1415 Spend extra time to make sure the smallest possible diff is
1416 produced.
1417
1418 --patience
1419 Generate a diff using the "patience diff" algorithm.
1420
1421 --histogram
1422 Generate a diff using the "histogram diff" algorithm.
1423
1424 --anchored=<text>
1425 Generate a diff using the "anchored diff" algorithm.
1426
1427 This option may be specified more than once.
1428
1429 If a line exists in both the source and destination, exists only
1430 once, and starts with this text, this algorithm attempts to prevent
1431 it from appearing as a deletion or addition in the output. It uses
1432 the "patience diff" algorithm internally.
1433
1434 --diff-algorithm={patience|minimal|histogram|myers}
1435 Choose a diff algorithm. The variants are as follows:
1436
1437 default, myers
1438 The basic greedy diff algorithm. Currently, this is the
1439 default.
1440
1441 minimal
1442 Spend extra time to make sure the smallest possible diff is
1443 produced.
1444
1445 patience
1446 Use "patience diff" algorithm when generating patches.
1447
1448 histogram
1449 This algorithm extends the patience algorithm to "support
1450 low-occurrence common elements".
1451
1452 For instance, if you configured the diff.algorithm variable to a
1453 non-default value and want to use the default one, then you have to
1454 use --diff-algorithm=default option.
1455
1456 --stat[=<width>[,<name-width>[,<count>]]]
1457 Generate a diffstat. By default, as much space as necessary will be
1458 used for the filename part, and the rest for the graph part.
1459 Maximum width defaults to terminal width, or 80 columns if not
1460 connected to a terminal, and can be overridden by <width>. The
1461 width of the filename part can be limited by giving another width
1462 <name-width> after a comma. The width of the graph part can be
1463 limited by using --stat-graph-width=<width> (affects all commands
1464 generating a stat graph) or by setting diff.statGraphWidth=<width>
1465 (does not affect git format-patch). By giving a third parameter
1466 <count>, you can limit the output to the first <count> lines,
1467 followed by ... if there are more.
1468
1469 These parameters can also be set individually with
1470 --stat-width=<width>, --stat-name-width=<name-width> and
1471 --stat-count=<count>.
1472
1473 --compact-summary
1474 Output a condensed summary of extended header information such as
1475 file creations or deletions ("new" or "gone", optionally "+l" if
1476 it’s a symlink) and mode changes ("+x" or "-x" for adding or
1477 removing executable bit respectively) in diffstat. The information
1478 is put between the filename part and the graph part. Implies
1479 --stat.
1480
1481 --numstat
1482 Similar to --stat, but shows number of added and deleted lines in
1483 decimal notation and pathname without abbreviation, to make it more
1484 machine friendly. For binary files, outputs two - instead of saying
1485 0 0.
1486
1487 --shortstat
1488 Output only the last line of the --stat format containing total
1489 number of modified files, as well as number of added and deleted
1490 lines.
1491
1492 -X[<param1,param2,...>], --dirstat[=<param1,param2,...>]
1493 Output the distribution of relative amount of changes for each
1494 sub-directory. The behavior of --dirstat can be customized by
1495 passing it a comma separated list of parameters. The defaults are
1496 controlled by the diff.dirstat configuration variable (see git-
1497 config(1)). The following parameters are available:
1498
1499 changes
1500 Compute the dirstat numbers by counting the lines that have
1501 been removed from the source, or added to the destination. This
1502 ignores the amount of pure code movements within a file. In
1503 other words, rearranging lines in a file is not counted as much
1504 as other changes. This is the default behavior when no
1505 parameter is given.
1506
1507 lines
1508 Compute the dirstat numbers by doing the regular line-based
1509 diff analysis, and summing the removed/added line counts. (For
1510 binary files, count 64-byte chunks instead, since binary files
1511 have no natural concept of lines). This is a more expensive
1512 --dirstat behavior than the changes behavior, but it does count
1513 rearranged lines within a file as much as other changes. The
1514 resulting output is consistent with what you get from the other
1515 --*stat options.
1516
1517 files
1518 Compute the dirstat numbers by counting the number of files
1519 changed. Each changed file counts equally in the dirstat
1520 analysis. This is the computationally cheapest --dirstat
1521 behavior, since it does not have to look at the file contents
1522 at all.
1523
1524 cumulative
1525 Count changes in a child directory for the parent directory as
1526 well. Note that when using cumulative, the sum of the
1527 percentages reported may exceed 100%. The default
1528 (non-cumulative) behavior can be specified with the
1529 noncumulative parameter.
1530
1531 <limit>
1532 An integer parameter specifies a cut-off percent (3% by
1533 default). Directories contributing less than this percentage of
1534 the changes are not shown in the output.
1535
1536 Example: The following will count changed files, while ignoring
1537 directories with less than 10% of the total amount of changed
1538 files, and accumulating child directory counts in the parent
1539 directories: --dirstat=files,10,cumulative.
1540
1541 --cumulative
1542 Synonym for --dirstat=cumulative
1543
1544 --dirstat-by-file[=<param1,param2>...]
1545 Synonym for --dirstat=files,param1,param2...
1546
1547 --summary
1548 Output a condensed summary of extended header information such as
1549 creations, renames and mode changes.
1550
1551 --patch-with-stat
1552 Synonym for -p --stat.
1553
1554 -z
1555 Separate the commits with NULs instead of with new newlines.
1556
1557 Also, when --raw or --numstat has been given, do not munge
1558 pathnames and use NULs as output field terminators.
1559
1560 Without this option, pathnames with "unusual" characters are quoted
1561 as explained for the configuration variable core.quotePath (see
1562 git-config(1)).
1563
1564 --name-only
1565 Show only names of changed files.
1566
1567 --name-status
1568 Show only names and status of changed files. See the description of
1569 the --diff-filter option on what the status letters mean.
1570
1571 --submodule[=<format>]
1572 Specify how differences in submodules are shown. When specifying
1573 --submodule=short the short format is used. This format just shows
1574 the names of the commits at the beginning and end of the range.
1575 When --submodule or --submodule=log is specified, the log format is
1576 used. This format lists the commits in the range like git-
1577 submodule(1) summary does. When --submodule=diff is specified, the
1578 diff format is used. This format shows an inline diff of the
1579 changes in the submodule contents between the commit range.
1580 Defaults to diff.submodule or the short format if the config option
1581 is unset.
1582
1583 --color[=<when>]
1584 Show colored diff. --color (i.e. without =<when>) is the same as
1585 --color=always. <when> can be one of always, never, or auto.
1586
1587 --no-color
1588 Turn off colored diff. It is the same as --color=never.
1589
1590 --color-moved[=<mode>]
1591 Moved lines of code are colored differently. The <mode> defaults to
1592 no if the option is not given and to zebra if the option with no
1593 mode is given. The mode must be one of:
1594
1595 no
1596 Moved lines are not highlighted.
1597
1598 default
1599 Is a synonym for zebra. This may change to a more sensible mode
1600 in the future.
1601
1602 plain
1603 Any line that is added in one location and was removed in
1604 another location will be colored with color.diff.newMoved.
1605 Similarly color.diff.oldMoved will be used for removed lines
1606 that are added somewhere else in the diff. This mode picks up
1607 any moved line, but it is not very useful in a review to
1608 determine if a block of code was moved without permutation.
1609
1610 blocks
1611 Blocks of moved text of at least 20 alphanumeric characters are
1612 detected greedily. The detected blocks are painted using either
1613 the color.diff.{old,new}Moved color. Adjacent blocks cannot be
1614 told apart.
1615
1616 zebra
1617 Blocks of moved text are detected as in blocks mode. The blocks
1618 are painted using either the color.diff.{old,new}Moved color or
1619 color.diff.{old,new}MovedAlternative. The change between the
1620 two colors indicates that a new block was detected.
1621
1622 dimmed-zebra
1623 Similar to zebra, but additional dimming of uninteresting parts
1624 of moved code is performed. The bordering lines of two adjacent
1625 blocks are considered interesting, the rest is uninteresting.
1626 dimmed_zebra is a deprecated synonym.
1627
1628 --no-color-moved
1629 Turn off move detection. This can be used to override configuration
1630 settings. It is the same as --color-moved=no.
1631
1632 --color-moved-ws=<modes>
1633 This configures how whitespace is ignored when performing the move
1634 detection for --color-moved. These modes can be given as a comma
1635 separated list:
1636
1637 no
1638 Do not ignore whitespace when performing move detection.
1639
1640 ignore-space-at-eol
1641 Ignore changes in whitespace at EOL.
1642
1643 ignore-space-change
1644 Ignore changes in amount of whitespace. This ignores whitespace
1645 at line end, and considers all other sequences of one or more
1646 whitespace characters to be equivalent.
1647
1648 ignore-all-space
1649 Ignore whitespace when comparing lines. This ignores
1650 differences even if one line has whitespace where the other
1651 line has none.
1652
1653 allow-indentation-change
1654 Initially ignore any whitespace in the move detection, then
1655 group the moved code blocks only into a block if the change in
1656 whitespace is the same per line. This is incompatible with the
1657 other modes.
1658
1659 --no-color-moved-ws
1660 Do not ignore whitespace when performing move detection. This can
1661 be used to override configuration settings. It is the same as
1662 --color-moved-ws=no.
1663
1664 --word-diff[=<mode>]
1665 Show a word diff, using the <mode> to delimit changed words. By
1666 default, words are delimited by whitespace; see --word-diff-regex
1667 below. The <mode> defaults to plain, and must be one of:
1668
1669 color
1670 Highlight changed words using only colors. Implies --color.
1671
1672 plain
1673 Show words as [-removed-] and {+added+}. Makes no attempts to
1674 escape the delimiters if they appear in the input, so the
1675 output may be ambiguous.
1676
1677 porcelain
1678 Use a special line-based format intended for script
1679 consumption. Added/removed/unchanged runs are printed in the
1680 usual unified diff format, starting with a +/-/` ` character at
1681 the beginning of the line and extending to the end of the line.
1682 Newlines in the input are represented by a tilde ~ on a line of
1683 its own.
1684
1685 none
1686 Disable word diff again.
1687
1688 Note that despite the name of the first mode, color is used to
1689 highlight the changed parts in all modes if enabled.
1690
1691 --word-diff-regex=<regex>
1692 Use <regex> to decide what a word is, instead of considering runs
1693 of non-whitespace to be a word. Also implies --word-diff unless it
1694 was already enabled.
1695
1696 Every non-overlapping match of the <regex> is considered a word.
1697 Anything between these matches is considered whitespace and
1698 ignored(!) for the purposes of finding differences. You may want to
1699 append |[^[:space:]] to your regular expression to make sure that
1700 it matches all non-whitespace characters. A match that contains a
1701 newline is silently truncated(!) at the newline.
1702
1703 For example, --word-diff-regex=. will treat each character as a
1704 word and, correspondingly, show differences character by character.
1705
1706 The regex can also be set via a diff driver or configuration
1707 option, see gitattributes(5) or git-config(1). Giving it explicitly
1708 overrides any diff driver or configuration setting. Diff drivers
1709 override configuration settings.
1710
1711 --color-words[=<regex>]
1712 Equivalent to --word-diff=color plus (if a regex was specified)
1713 --word-diff-regex=<regex>.
1714
1715 --no-renames
1716 Turn off rename detection, even when the configuration file gives
1717 the default to do so.
1718
1719 --[no-]rename-empty
1720 Whether to use empty blobs as rename source.
1721
1722 --check
1723 Warn if changes introduce conflict markers or whitespace errors.
1724 What are considered whitespace errors is controlled by
1725 core.whitespace configuration. By default, trailing whitespaces
1726 (including lines that consist solely of whitespaces) and a space
1727 character that is immediately followed by a tab character inside
1728 the initial indent of the line are considered whitespace errors.
1729 Exits with non-zero status if problems are found. Not compatible
1730 with --exit-code.
1731
1732 --ws-error-highlight=<kind>
1733 Highlight whitespace errors in the context, old or new lines of the
1734 diff. Multiple values are separated by comma, none resets previous
1735 values, default reset the list to new and all is a shorthand for
1736 old,new,context. When this option is not given, and the
1737 configuration variable diff.wsErrorHighlight is not set, only
1738 whitespace errors in new lines are highlighted. The whitespace
1739 errors are colored with color.diff.whitespace.
1740
1741 --full-index
1742 Instead of the first handful of characters, show the full pre- and
1743 post-image blob object names on the "index" line when generating
1744 patch format output.
1745
1746 --binary
1747 In addition to --full-index, output a binary diff that can be
1748 applied with git-apply. Implies --patch.
1749
1750 --abbrev[=<n>]
1751 Instead of showing the full 40-byte hexadecimal object name in
1752 diff-raw format output and diff-tree header lines, show only a
1753 partial prefix. This is independent of the --full-index option
1754 above, which controls the diff-patch output format. Non default
1755 number of digits can be specified with --abbrev=<n>.
1756
1757 -B[<n>][/<m>], --break-rewrites[=[<n>][/<m>]]
1758 Break complete rewrite changes into pairs of delete and create.
1759 This serves two purposes:
1760
1761 It affects the way a change that amounts to a total rewrite of a
1762 file not as a series of deletion and insertion mixed together with
1763 a very few lines that happen to match textually as the context, but
1764 as a single deletion of everything old followed by a single
1765 insertion of everything new, and the number m controls this aspect
1766 of the -B option (defaults to 60%). -B/70% specifies that less
1767 than 30% of the original should remain in the result for Git to
1768 consider it a total rewrite (i.e. otherwise the resulting patch
1769 will be a series of deletion and insertion mixed together with
1770 context lines).
1771
1772 When used with -M, a totally-rewritten file is also considered as
1773 the source of a rename (usually -M only considers a file that
1774 disappeared as the source of a rename), and the number n controls
1775 this aspect of the -B option (defaults to 50%). -B20% specifies
1776 that a change with addition and deletion compared to 20% or more of
1777 the file’s size are eligible for being picked up as a possible
1778 source of a rename to another file.
1779
1780 -M[<n>], --find-renames[=<n>]
1781 If generating diffs, detect and report renames for each commit. For
1782 following files across renames while traversing history, see
1783 --follow. If n is specified, it is a threshold on the similarity
1784 index (i.e. amount of addition/deletions compared to the file’s
1785 size). For example, -M90% means Git should consider a delete/add
1786 pair to be a rename if more than 90% of the file hasn’t changed.
1787 Without a % sign, the number is to be read as a fraction, with a
1788 decimal point before it. I.e., -M5 becomes 0.5, and is thus the
1789 same as -M50%. Similarly, -M05 is the same as -M5%. To limit
1790 detection to exact renames, use -M100%. The default similarity
1791 index is 50%.
1792
1793 -C[<n>], --find-copies[=<n>]
1794 Detect copies as well as renames. See also --find-copies-harder. If
1795 n is specified, it has the same meaning as for -M<n>.
1796
1797 --find-copies-harder
1798 For performance reasons, by default, -C option finds copies only if
1799 the original file of the copy was modified in the same changeset.
1800 This flag makes the command inspect unmodified files as candidates
1801 for the source of copy. This is a very expensive operation for
1802 large projects, so use it with caution. Giving more than one -C
1803 option has the same effect.
1804
1805 -D, --irreversible-delete
1806 Omit the preimage for deletes, i.e. print only the header but not
1807 the diff between the preimage and /dev/null. The resulting patch is
1808 not meant to be applied with patch or git apply; this is solely for
1809 people who want to just concentrate on reviewing the text after the
1810 change. In addition, the output obviously lacks enough information
1811 to apply such a patch in reverse, even manually, hence the name of
1812 the option.
1813
1814 When used together with -B, omit also the preimage in the deletion
1815 part of a delete/create pair.
1816
1817 -l<num>
1818 The -M and -C options require O(n^2) processing time where n is the
1819 number of potential rename/copy targets. This option prevents
1820 rename/copy detection from running if the number of rename/copy
1821 targets exceeds the specified number.
1822
1823 --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
1824 Select only files that are Added (A), Copied (C), Deleted (D),
1825 Modified (M), Renamed (R), have their type (i.e. regular file,
1826 symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown
1827 (X), or have had their pairing Broken (B). Any combination of the
1828 filter characters (including none) can be used. When *
1829 (All-or-none) is added to the combination, all paths are selected
1830 if there is any file that matches other criteria in the comparison;
1831 if there is no file that matches other criteria, nothing is
1832 selected.
1833
1834 Also, these upper-case letters can be downcased to exclude. E.g.
1835 --diff-filter=ad excludes added and deleted paths.
1836
1837 Note that not all diffs can feature all types. For instance, diffs
1838 from the index to the working tree can never have Added entries
1839 (because the set of paths included in the diff is limited by what
1840 is in the index). Similarly, copied and renamed entries cannot
1841 appear if detection for those types is disabled.
1842
1843 -S<string>
1844 Look for differences that change the number of occurrences of the
1845 specified string (i.e. addition/deletion) in a file. Intended for
1846 the scripter’s use.
1847
1848 It is useful when you’re looking for an exact block of code (like a
1849 struct), and want to know the history of that block since it first
1850 came into being: use the feature iteratively to feed the
1851 interesting block in the preimage back into -S, and keep going
1852 until you get the very first version of the block.
1853
1854 Binary files are searched as well.
1855
1856 -G<regex>
1857 Look for differences whose patch text contains added/removed lines
1858 that match <regex>.
1859
1860 To illustrate the difference between -S<regex> --pickaxe-regex and
1861 -G<regex>, consider a commit with the following diff in the same
1862 file:
1863
1864 + return frotz(nitfol, two->ptr, 1, 0);
1865 ...
1866 - hit = frotz(nitfol, mf2.ptr, 1, 0);
1867
1868 While git log -G"frotz\(nitfol" will show this commit, git log
1869 -S"frotz\(nitfol" --pickaxe-regex will not (because the number of
1870 occurrences of that string did not change).
1871
1872 Unless --text is supplied patches of binary files without a
1873 textconv filter will be ignored.
1874
1875 See the pickaxe entry in gitdiffcore(7) for more information.
1876
1877 --find-object=<object-id>
1878 Look for differences that change the number of occurrences of the
1879 specified object. Similar to -S, just the argument is different in
1880 that it doesn’t search for a specific string but for a specific
1881 object id.
1882
1883 The object can be a blob or a submodule commit. It implies the -t
1884 option in git-log to also find trees.
1885
1886 --pickaxe-all
1887 When -S or -G finds a change, show all the changes in that
1888 changeset, not just the files that contain the change in <string>.
1889
1890 --pickaxe-regex
1891 Treat the <string> given to -S as an extended POSIX regular
1892 expression to match.
1893
1894 -O<orderfile>
1895 Control the order in which files appear in the output. This
1896 overrides the diff.orderFile configuration variable (see git-
1897 config(1)). To cancel diff.orderFile, use -O/dev/null.
1898
1899 The output order is determined by the order of glob patterns in
1900 <orderfile>. All files with pathnames that match the first pattern
1901 are output first, all files with pathnames that match the second
1902 pattern (but not the first) are output next, and so on. All files
1903 with pathnames that do not match any pattern are output last, as if
1904 there was an implicit match-all pattern at the end of the file. If
1905 multiple pathnames have the same rank (they match the same pattern
1906 but no earlier patterns), their output order relative to each other
1907 is the normal order.
1908
1909 <orderfile> is parsed as follows:
1910
1911 · Blank lines are ignored, so they can be used as separators for
1912 readability.
1913
1914 · Lines starting with a hash ("#") are ignored, so they can be
1915 used for comments. Add a backslash ("\") to the beginning of
1916 the pattern if it starts with a hash.
1917
1918 · Each other line contains a single pattern.
1919
1920 Patterns have the same syntax and semantics as patterns used for
1921 fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
1922 matches a pattern if removing any number of the final pathname
1923 components matches the pattern. For example, the pattern "foo*bar"
1924 matches "fooasdfbar" and "foo/bar/baz/asdf" but not "foobarx".
1925
1926 -R
1927 Swap two inputs; that is, show differences from index or on-disk
1928 file to tree contents.
1929
1930 --relative[=<path>]
1931 When run from a subdirectory of the project, it can be told to
1932 exclude changes outside the directory and show pathnames relative
1933 to it with this option. When you are not in a subdirectory (e.g. in
1934 a bare repository), you can name which subdirectory to make the
1935 output relative to by giving a <path> as an argument.
1936
1937 -a, --text
1938 Treat all files as text.
1939
1940 --ignore-cr-at-eol
1941 Ignore carriage-return at the end of line when doing a comparison.
1942
1943 --ignore-space-at-eol
1944 Ignore changes in whitespace at EOL.
1945
1946 -b, --ignore-space-change
1947 Ignore changes in amount of whitespace. This ignores whitespace at
1948 line end, and considers all other sequences of one or more
1949 whitespace characters to be equivalent.
1950
1951 -w, --ignore-all-space
1952 Ignore whitespace when comparing lines. This ignores differences
1953 even if one line has whitespace where the other line has none.
1954
1955 --ignore-blank-lines
1956 Ignore changes whose lines are all blank.
1957
1958 --inter-hunk-context=<lines>
1959 Show the context between diff hunks, up to the specified number of
1960 lines, thereby fusing hunks that are close to each other. Defaults
1961 to diff.interHunkContext or 0 if the config option is unset.
1962
1963 -W, --function-context
1964 Show whole surrounding functions of changes.
1965
1966 --ext-diff
1967 Allow an external diff helper to be executed. If you set an
1968 external diff driver with gitattributes(5), you need to use this
1969 option with git-log(1) and friends.
1970
1971 --no-ext-diff
1972 Disallow external diff drivers.
1973
1974 --textconv, --no-textconv
1975 Allow (or disallow) external text conversion filters to be run when
1976 comparing binary files. See gitattributes(5) for details. Because
1977 textconv filters are typically a one-way conversion, the resulting
1978 diff is suitable for human consumption, but cannot be applied. For
1979 this reason, textconv filters are enabled by default only for git-
1980 diff(1) and git-log(1), but not for git-format-patch(1) or diff
1981 plumbing commands.
1982
1983 --ignore-submodules[=<when>]
1984 Ignore changes to submodules in the diff generation. <when> can be
1985 either "none", "untracked", "dirty" or "all", which is the default.
1986 Using "none" will consider the submodule modified when it either
1987 contains untracked or modified files or its HEAD differs from the
1988 commit recorded in the superproject and can be used to override any
1989 settings of the ignore option in git-config(1) or gitmodules(5).
1990 When "untracked" is used submodules are not considered dirty when
1991 they only contain untracked content (but they are still scanned for
1992 modified content). Using "dirty" ignores all changes to the work
1993 tree of submodules, only changes to the commits stored in the
1994 superproject are shown (this was the behavior until 1.7.0). Using
1995 "all" hides all changes to submodules.
1996
1997 --src-prefix=<prefix>
1998 Show the given source prefix instead of "a/".
1999
2000 --dst-prefix=<prefix>
2001 Show the given destination prefix instead of "b/".
2002
2003 --no-prefix
2004 Do not show any source or destination prefix.
2005
2006 --line-prefix=<prefix>
2007 Prepend an additional prefix to every line of output.
2008
2009 --ita-invisible-in-index
2010 By default entries added by "git add -N" appear as an existing
2011 empty file in "git diff" and a new file in "git diff --cached".
2012 This option makes the entry appear as a new file in "git diff" and
2013 non-existent in "git diff --cached". This option could be reverted
2014 with --ita-visible-in-index. Both options are experimental and
2015 could be removed in future.
2016
2017 For more detailed explanation on these common options, see also
2018 gitdiffcore(7).
2019
2021 Running git-diff(1), git-log(1), git-show(1), git-diff-index(1), git-
2022 diff-tree(1), or git-diff-files(1) with the -p option produces patch
2023 text. You can customize the creation of patch text via the
2024 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.
2025
2026 What the -p option produces is slightly different from the traditional
2027 diff format:
2028
2029 1. It is preceded with a "git diff" header that looks like this:
2030
2031 diff --git a/file1 b/file2
2032
2033 The a/ and b/ filenames are the same unless rename/copy is
2034 involved. Especially, even for a creation or a deletion, /dev/null
2035 is not used in place of the a/ or b/ filenames.
2036
2037 When rename/copy is involved, file1 and file2 show the name of the
2038 source file of the rename/copy and the name of the file that
2039 rename/copy produces, respectively.
2040
2041 2. It is followed by one or more extended header lines:
2042
2043 old mode <mode>
2044 new mode <mode>
2045 deleted file mode <mode>
2046 new file mode <mode>
2047 copy from <path>
2048 copy to <path>
2049 rename from <path>
2050 rename to <path>
2051 similarity index <number>
2052 dissimilarity index <number>
2053 index <hash>..<hash> <mode>
2054
2055 File modes are printed as 6-digit octal numbers including the file
2056 type and file permission bits.
2057
2058 Path names in extended headers do not include the a/ and b/
2059 prefixes.
2060
2061 The similarity index is the percentage of unchanged lines, and the
2062 dissimilarity index is the percentage of changed lines. It is a
2063 rounded down integer, followed by a percent sign. The similarity
2064 index value of 100% is thus reserved for two equal files, while
2065 100% dissimilarity means that no line from the old file made it
2066 into the new one.
2067
2068 The index line includes the blob object names before and after the
2069 change. The <mode> is included if the file mode does not change;
2070 otherwise, separate lines indicate the old and the new mode.
2071
2072 3. Pathnames with "unusual" characters are quoted as explained for the
2073 configuration variable core.quotePath (see git-config(1)).
2074
2075 4. All the file1 files in the output refer to files before the commit,
2076 and all the file2 files refer to files after the commit. It is
2077 incorrect to apply each change to each file sequentially. For
2078 example, this patch will swap a and b:
2079
2080 diff --git a/a b/b
2081 rename from a
2082 rename to b
2083 diff --git a/b b/a
2084 rename from b
2085 rename to a
2086
2088 Any diff-generating command can take the -c or --cc option to produce a
2089 combined diff when showing a merge. This is the default format when
2090 showing merges with git-diff(1) or git-show(1). Note also that you can
2091 give the -m option to any of these commands to force generation of
2092 diffs with individual parents of a merge.
2093
2094 A "combined diff" format looks like this:
2095
2096 diff --combined describe.c
2097 index fabadb8,cc95eb0..4866510
2098 --- a/describe.c
2099 +++ b/describe.c
2100 @@@ -98,20 -98,12 +98,20 @@@
2101 return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
2102 }
2103
2104 - static void describe(char *arg)
2105 -static void describe(struct commit *cmit, int last_one)
2106 ++static void describe(char *arg, int last_one)
2107 {
2108 + unsigned char sha1[20];
2109 + struct commit *cmit;
2110 struct commit_list *list;
2111 static int initialized = 0;
2112 struct commit_name *n;
2113
2114 + if (get_sha1(arg, sha1) < 0)
2115 + usage(describe_usage);
2116 + cmit = lookup_commit_reference(sha1);
2117 + if (!cmit)
2118 + usage(describe_usage);
2119 +
2120 if (!initialized) {
2121 initialized = 1;
2122 for_each_ref(get_name);
2123
2124 1. It is preceded with a "git diff" header, that looks like this (when
2125 the -c option is used):
2126
2127 diff --combined file
2128
2129 or like this (when the --cc option is used):
2130
2131 diff --cc file
2132
2133 2. It is followed by one or more extended header lines (this example
2134 shows a merge with two parents):
2135
2136 index <hash>,<hash>..<hash>
2137 mode <mode>,<mode>..<mode>
2138 new file mode <mode>
2139 deleted file mode <mode>,<mode>
2140
2141 The mode <mode>,<mode>..<mode> line appears only if at least one of
2142 the <mode> is different from the rest. Extended headers with
2143 information about detected contents movement (renames and copying
2144 detection) are designed to work with diff of two <tree-ish> and are
2145 not used by combined diff format.
2146
2147 3. It is followed by two-line from-file/to-file header
2148
2149 --- a/file
2150 +++ b/file
2151
2152 Similar to two-line header for traditional unified diff format,
2153 /dev/null is used to signal created or deleted files.
2154
2155 However, if the --combined-all-paths option is provided, instead of
2156 a two-line from-file/to-file you get a N+1 line from-file/to-file
2157 header, where N is the number of parents in the merge commit
2158
2159 --- a/file
2160 --- a/file
2161 --- a/file
2162 +++ b/file
2163
2164 This extended format can be useful if rename or copy detection is
2165 active, to allow you to see the original name of the file in
2166 different parents.
2167
2168 4. Chunk header format is modified to prevent people from accidentally
2169 feeding it to patch -p1. Combined diff format was created for
2170 review of merge commit changes, and was not meant to be applied.
2171 The change is similar to the change in the extended index header:
2172
2173 @@@ <from-file-range> <from-file-range> <to-file-range> @@@
2174
2175 There are (number of parents + 1) @ characters in the chunk header
2176 for combined diff format.
2177
2178 Unlike the traditional unified diff format, which shows two files A and
2179 B with a single column that has - (minus — appears in A but removed in
2180 B), + (plus — missing in A but added to B), or " " (space — unchanged)
2181 prefix, this format compares two or more files file1, file2,... with
2182 one file X, and shows how X differs from each of fileN. One column for
2183 each of fileN is prepended to the output line to note how X’s line is
2184 different from it.
2185
2186 A - character in the column N means that the line appears in fileN but
2187 it does not appear in the result. A + character in the column N means
2188 that the line appears in the result, and fileN does not have that line
2189 (in other words, the line was added, from the point of view of that
2190 parent).
2191
2192 In the above example output, the function signature was changed from
2193 both files (hence two - removals from both file1 and file2, plus ++ to
2194 mean one line that was added does not appear in either file1 or file2).
2195 Also eight other lines are the same from file1 but do not appear in
2196 file2 (hence prefixed with +).
2197
2198 When shown by git diff-tree -c, it compares the parents of a merge
2199 commit with the merge result (i.e. file1..fileN are the parents). When
2200 shown by git diff-files -c, it compares the two unresolved merge
2201 parents with the working tree file (i.e. file1 is stage 2 aka "our
2202 version", file2 is stage 3 aka "their version").
2203
2205 git log --no-merges
2206 Show the whole commit history, but skip any merges
2207
2208 git log v2.6.12.. include/scsi drivers/scsi
2209 Show all commits since version v2.6.12 that changed any file in the
2210 include/scsi or drivers/scsi subdirectories
2211
2212 git log --since="2 weeks ago" -- gitk
2213 Show the changes during the last two weeks to the file gitk. The --
2214 is necessary to avoid confusion with the branch named gitk
2215
2216 git log --name-status release..test
2217 Show the commits that are in the "test" branch but not yet in the
2218 "release" branch, along with the list of paths each commit
2219 modifies.
2220
2221 git log --follow builtin/rev-list.c
2222 Shows the commits that changed builtin/rev-list.c, including those
2223 commits that occurred before the file was given its present name.
2224
2225 git log --branches --not --remotes=origin
2226 Shows all commits that are in any of local branches but not in any
2227 of remote-tracking branches for origin (what you have that origin
2228 doesn’t).
2229
2230 git log master --not --remotes=*/master
2231 Shows all commits that are in local master but not in any remote
2232 repository master branches.
2233
2234 git log -p -m --first-parent
2235 Shows the history including change diffs, but only from the “main
2236 branch” perspective, skipping commits that come from merged
2237 branches, and showing full diffs of changes introduced by the
2238 merges. This makes sense only when following a strict policy of
2239 merging all topic branches when staying on a single integration
2240 branch.
2241
2242 git log -L '/int main/',/^}/:main.c
2243 Shows how the function main() in the file main.c evolved over time.
2244
2245 git log -3
2246 Limits the number of commits to show to 3.
2247
2249 Git is to some extent character encoding agnostic.
2250
2251 · The contents of the blob objects are uninterpreted sequences of
2252 bytes. There is no encoding translation at the core level.
2253
2254 · Path names are encoded in UTF-8 normalization form C. This applies
2255 to tree objects, the index file, ref names, as well as path names
2256 in command line arguments, environment variables and config files
2257 (.git/config (see git-config(1)), gitignore(5), gitattributes(5)
2258 and gitmodules(5)).
2259
2260 Note that Git at the core level treats path names simply as
2261 sequences of non-NUL bytes, there are no path name encoding
2262 conversions (except on Mac and Windows). Therefore, using non-ASCII
2263 path names will mostly work even on platforms and file systems that
2264 use legacy extended ASCII encodings. However, repositories created
2265 on such systems will not work properly on UTF-8-based systems (e.g.
2266 Linux, Mac, Windows) and vice versa. Additionally, many Git-based
2267 tools simply assume path names to be UTF-8 and will fail to display
2268 other encodings correctly.
2269
2270 · Commit log messages are typically encoded in UTF-8, but other
2271 extended ASCII encodings are also supported. This includes
2272 ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and
2273 CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).
2274
2275 Although we encourage that the commit log messages are encoded in
2276 UTF-8, both the core and Git Porcelain are designed not to force UTF-8
2277 on projects. If all participants of a particular project find it more
2278 convenient to use legacy encodings, Git does not forbid it. However,
2279 there are a few things to keep in mind.
2280
2281 1. git commit and git commit-tree issues a warning if the commit log
2282 message given to it does not look like a valid UTF-8 string, unless
2283 you explicitly say your project uses a legacy encoding. The way to
2284 say this is to have i18n.commitencoding in .git/config file, like
2285 this:
2286
2287 [i18n]
2288 commitEncoding = ISO-8859-1
2289
2290 Commit objects created with the above setting record the value of
2291 i18n.commitEncoding in its encoding header. This is to help other
2292 people who look at them later. Lack of this header implies that the
2293 commit log message is encoded in UTF-8.
2294
2295 2. git log, git show, git blame and friends look at the encoding
2296 header of a commit object, and try to re-code the log message into
2297 UTF-8 unless otherwise specified. You can specify the desired
2298 output encoding with i18n.logOutputEncoding in .git/config file,
2299 like this:
2300
2301 [i18n]
2302 logOutputEncoding = ISO-8859-1
2303
2304 If you do not have this configuration variable, the value of
2305 i18n.commitEncoding is used instead.
2306
2307 Note that we deliberately chose not to re-code the commit log message
2308 when a commit is made to force UTF-8 at the commit object level,
2309 because re-coding to UTF-8 is not necessarily a reversible operation.
2310
2312 See git-config(1) for core variables and git-diff(1) for settings
2313 related to diff generation.
2314
2315 format.pretty
2316 Default for the --format option. (See Pretty Formats above.)
2317 Defaults to medium.
2318
2319 i18n.logOutputEncoding
2320 Encoding to use when displaying logs. (See Discussion above.)
2321 Defaults to the value of i18n.commitEncoding if set, and UTF-8
2322 otherwise.
2323
2324 log.date
2325 Default format for human-readable dates. (Compare the --date
2326 option.) Defaults to "default", which means to write dates like Sat
2327 May 8 19:35:34 2010 -0500.
2328
2329 If the format is set to "auto:foo" and the pager is in use, format
2330 "foo" will be the used for the date format. Otherwise "default"
2331 will be used.
2332
2333 log.follow
2334 If true, git log will act as if the --follow option was used when a
2335 single <path> is given. This has the same limitations as --follow,
2336 i.e. it cannot be used to follow multiple files and does not work
2337 well on non-linear history.
2338
2339 log.showRoot
2340 If false, git log and related commands will not treat the initial
2341 commit as a big creation event. Any root commits in git log -p
2342 output would be shown without a diff attached. The default is true.
2343
2344 log.showSignature
2345 If true, git log and related commands will act as if the
2346 --show-signature option was passed to them.
2347
2348 mailmap.*
2349 See git-shortlog(1).
2350
2351 notes.displayRef
2352 Which refs, in addition to the default set by core.notesRef or
2353 GIT_NOTES_REF, to read notes from when showing commit messages with
2354 the log family of commands. See git-notes(1).
2355
2356 May be an unabbreviated ref name or a glob and may be specified
2357 multiple times. A warning will be issued for refs that do not
2358 exist, but a glob that does not match any refs is silently ignored.
2359
2360 This setting can be disabled by the --no-notes option, overridden
2361 by the GIT_NOTES_DISPLAY_REF environment variable, and overridden
2362 by the --notes=<ref> option.
2363
2365 Part of the git(1) suite
2366
2367
2368
2369Git 2.26.2 2020-04-20 GIT-LOG(1)