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