1GIT-REV-LIST(1) Git Manual GIT-REV-LIST(1)
2
3
4
6 git-rev-list - Lists commit objects in reverse chronological order
7
9 git rev-list [<options>] <commit>... [[--] <path>...]
10
12 List commits that are reachable by following the parent links from the
13 given commit(s), but exclude commits that are reachable from the one(s)
14 given with a ^ in front of them. The output is given in reverse
15 chronological order by default.
16
17 You can think of this as a set operation. Commits reachable from any of
18 the commits given on the command line form a set, and then commits
19 reachable from any of the ones given with ^ in front are subtracted
20 from that set. The remaining commits are what comes out in the
21 command’s output. Various other options and paths parameters can be
22 used to further limit the result.
23
24 Thus, the following command:
25
26 $ git rev-list foo bar ^baz
27
28 means "list all the commits which are reachable from foo or bar, but
29 not from baz".
30
31 A special notation "<commit1>..<commit2>" can be used as a short-hand
32 for "^<commit1> <commit2>". For example, either of the following may be
33 used interchangeably:
34
35 $ git rev-list origin..HEAD
36 $ git rev-list HEAD ^origin
37
38 Another special notation is "<commit1>...<commit2>" which is useful for
39 merges. The resulting set of commits is the symmetric difference
40 between the two operands. The following two commands are equivalent:
41
42 $ git rev-list A B --not $(git merge-base --all A B)
43 $ git rev-list A...B
44
45 rev-list is a very essential Git command, since it provides the ability
46 to build and traverse commit ancestry graphs. For this reason, it has a
47 lot of different options that enables it to be used by commands as
48 different as git bisect and git repack.
49
51 Commit Limiting
52 Besides specifying a range of commits that should be listed using the
53 special notations explained in the description, additional commit
54 limiting may be applied.
55
56 Using more options generally further limits the output (e.g.
57 --since=<date1> limits to commits newer than <date1>, and using it with
58 --grep=<pattern> further limits to commits whose log message has a line
59 that matches <pattern>), unless otherwise noted.
60
61 Note that these are applied before commit ordering and formatting
62 options, such as --reverse.
63
64 -<number>, -n <number>, --max-count=<number>
65 Limit the number of commits to output.
66
67 --skip=<number>
68 Skip number commits before starting to show the commit output.
69
70 --since=<date>, --after=<date>
71 Show commits more recent than a specific date.
72
73 --until=<date>, --before=<date>
74 Show commits older than a specific date.
75
76 --max-age=<timestamp>, --min-age=<timestamp>
77 Limit the commits output to specified time range.
78
79 --author=<pattern>, --committer=<pattern>
80 Limit the commits output to ones with author/committer header lines
81 that match the specified pattern (regular expression). With more
82 than one --author=<pattern>, commits whose author matches any of
83 the given patterns are chosen (similarly for multiple
84 --committer=<pattern>).
85
86 --grep-reflog=<pattern>
87 Limit the commits output to ones with reflog entries that match the
88 specified pattern (regular expression). With more than one
89 --grep-reflog, commits whose reflog message matches any of the
90 given patterns are chosen. It is an error to use this option unless
91 --walk-reflogs is in use.
92
93 --grep=<pattern>
94 Limit the commits output to ones with log message that matches the
95 specified pattern (regular expression). With more than one
96 --grep=<pattern>, commits whose message matches any of the given
97 patterns are chosen (but see --all-match).
98
99 --all-match
100 Limit the commits output to ones that match all given --grep,
101 instead of ones that match at least one.
102
103 --invert-grep
104 Limit the commits output to ones with log message that do not match
105 the pattern specified with --grep=<pattern>.
106
107 -i, --regexp-ignore-case
108 Match the regular expression limiting patterns without regard to
109 letter case.
110
111 --basic-regexp
112 Consider the limiting patterns to be basic regular expressions;
113 this is the default.
114
115 -E, --extended-regexp
116 Consider the limiting patterns to be extended regular expressions
117 instead of the default basic regular expressions.
118
119 -F, --fixed-strings
120 Consider the limiting patterns to be fixed strings (don’t interpret
121 pattern as a regular expression).
122
123 -P, --perl-regexp
124 Consider the limiting patterns to be Perl-compatible regular
125 expressions.
126
127 Support for these types of regular expressions is an optional
128 compile-time dependency. If Git wasn’t compiled with support for
129 them providing this option will cause it to die.
130
131 --remove-empty
132 Stop when a given path disappears from the tree.
133
134 --merges
135 Print only merge commits. This is exactly the same as
136 --min-parents=2.
137
138 --no-merges
139 Do not print commits with more than one parent. This is exactly the
140 same as --max-parents=1.
141
142 --min-parents=<number>, --max-parents=<number>, --no-min-parents,
143 --no-max-parents
144 Show only commits which have at least (or at most) that many parent
145 commits. In particular, --max-parents=1 is the same as --no-merges,
146 --min-parents=2 is the same as --merges. --max-parents=0 gives all
147 root commits and --min-parents=3 all octopus merges.
148
149 --no-min-parents and --no-max-parents reset these limits (to no
150 limit) again. Equivalent forms are --min-parents=0 (any commit has
151 0 or more parents) and --max-parents=-1 (negative numbers denote no
152 upper limit).
153
154 --first-parent
155 Follow only the first parent commit upon seeing a merge commit.
156 This option can give a better overview when viewing the evolution
157 of a particular topic branch, because merges into a topic branch
158 tend to be only about adjusting to updated upstream from time to
159 time, and this option allows you to ignore the individual commits
160 brought in to your history by such a merge.
161
162 --not
163 Reverses the meaning of the ^ prefix (or lack thereof) for all
164 following revision specifiers, up to the next --not.
165
166 --all
167 Pretend as if all the refs in refs/, along with HEAD, are listed on
168 the command line as <commit>.
169
170 --branches[=<pattern>]
171 Pretend as if all the refs in refs/heads are listed on the command
172 line as <commit>. If <pattern> is given, limit branches to ones
173 matching given shell glob. If pattern lacks ?, *, or [, /* at the
174 end is implied.
175
176 --tags[=<pattern>]
177 Pretend as if all the refs in refs/tags are listed on the command
178 line as <commit>. If <pattern> is given, limit tags to ones
179 matching given shell glob. If pattern lacks ?, *, or [, /* at the
180 end is implied.
181
182 --remotes[=<pattern>]
183 Pretend as if all the refs in refs/remotes are listed on the
184 command line as <commit>. If <pattern> is given, limit
185 remote-tracking branches to ones matching given shell glob. If
186 pattern lacks ?, *, or [, /* at the end is implied.
187
188 --glob=<glob-pattern>
189 Pretend as if all the refs matching shell glob <glob-pattern> are
190 listed on the command line as <commit>. Leading refs/, is
191 automatically prepended if missing. If pattern lacks ?, *, or [, /*
192 at the end is implied.
193
194 --exclude=<glob-pattern>
195 Do not include refs matching <glob-pattern> that the next --all,
196 --branches, --tags, --remotes, or --glob would otherwise consider.
197 Repetitions of this option accumulate exclusion patterns up to the
198 next --all, --branches, --tags, --remotes, or --glob option (other
199 options or arguments do not clear accumulated patterns).
200
201 The patterns given should not begin with refs/heads, refs/tags, or
202 refs/remotes when applied to --branches, --tags, or --remotes,
203 respectively, and they must begin with refs/ when applied to --glob
204 or --all. If a trailing /* is intended, it must be given
205 explicitly.
206
207 --reflog
208 Pretend as if all objects mentioned by reflogs are listed on the
209 command line as <commit>.
210
211 --alternate-refs
212 Pretend as if all objects mentioned as ref tips of alternate
213 repositories were listed on the command line. An alternate
214 repository is any repository whose object directory is specified in
215 objects/info/alternates. The set of included objects may be
216 modified by core.alternateRefsCommand, etc. See git-config(1).
217
218 --single-worktree
219 By default, all working trees will be examined by the following
220 options when there are more than one (see git-worktree(1)): --all,
221 --reflog and --indexed-objects. This option forces them to examine
222 the current working tree only.
223
224 --ignore-missing
225 Upon seeing an invalid object name in the input, pretend as if the
226 bad input was not given.
227
228 --stdin
229 In addition to the <commit> listed on the command line, read them
230 from the standard input. If a -- separator is seen, stop reading
231 commits and start reading paths to limit the result.
232
233 --quiet
234 Don’t print anything to standard output. This form is primarily
235 meant to allow the caller to test the exit status to see if a range
236 of objects is fully connected (or not). It is faster than
237 redirecting stdout to /dev/null as the output does not have to be
238 formatted.
239
240 --disk-usage
241 Suppress normal output; instead, print the sum of the bytes used
242 for on-disk storage by the selected commits or objects. This is
243 equivalent to piping the output into git cat-file
244 --batch-check='%(objectsize:disk)', except that it runs much faster
245 (especially with --use-bitmap-index). See the CAVEATS section in
246 git-cat-file(1) for the limitations of what "on-disk storage"
247 means.
248
249 --cherry-mark
250 Like --cherry-pick (see below) but mark equivalent commits with =
251 rather than omitting them, and inequivalent ones with +.
252
253 --cherry-pick
254 Omit any commit that introduces the same change as another commit
255 on the “other side” when the set of commits are limited with
256 symmetric difference.
257
258 For example, if you have two branches, A and B, a usual way to list
259 all commits on only one side of them is with --left-right (see the
260 example below in the description of the --left-right option).
261 However, it shows the commits that were cherry-picked from the
262 other branch (for example, “3rd on b” may be cherry-picked from
263 branch A). With this option, such pairs of commits are excluded
264 from the output.
265
266 --left-only, --right-only
267 List only commits on the respective side of a symmetric difference,
268 i.e. only those which would be marked < resp. > by --left-right.
269
270 For example, --cherry-pick --right-only A...B omits those commits
271 from B which are in A or are patch-equivalent to a commit in A. In
272 other words, this lists the + commits from git cherry A B. More
273 precisely, --cherry-pick --right-only --no-merges gives the exact
274 list.
275
276 --cherry
277 A synonym for --right-only --cherry-mark --no-merges; useful to
278 limit the output to the commits on our side and mark those that
279 have been applied to the other side of a forked history with git
280 log --cherry upstream...mybranch, similar to git cherry upstream
281 mybranch.
282
283 -g, --walk-reflogs
284 Instead of walking the commit ancestry chain, walk reflog entries
285 from the most recent one to older ones. When this option is used
286 you cannot specify commits to exclude (that is, ^commit,
287 commit1..commit2, and commit1...commit2 notations cannot be used).
288
289 With --pretty format other than oneline and reference (for obvious
290 reasons), this causes the output to have two extra lines of
291 information taken from the reflog. The reflog designator in the
292 output may be shown as ref@{Nth} (where Nth is the
293 reverse-chronological index in the reflog) or as ref@{timestamp}
294 (with the timestamp for that entry), depending on a few rules:
295
296 1. If the starting point is specified as ref@{Nth}, show the index
297 format.
298
299 2. If the starting point was specified as ref@{now}, show the
300 timestamp format.
301
302 3. If neither was used, but --date was given on the command line,
303 show the timestamp in the format requested by --date.
304
305 4. Otherwise, show the index format.
306
307 Under --pretty=oneline, the commit message is prefixed with this
308 information on the same line. This option cannot be combined with
309 --reverse. See also git-reflog(1).
310
311 Under --pretty=reference, this information will not be shown at
312 all.
313
314 --merge
315 After a failed merge, show refs that touch files having a conflict
316 and don’t exist on all heads to merge.
317
318 --boundary
319 Output excluded boundary commits. Boundary commits are prefixed
320 with -.
321
322 --use-bitmap-index
323 Try to speed up the traversal using the pack bitmap index (if one
324 is available). Note that when traversing with --objects, trees and
325 blobs will not have their associated path printed.
326
327 --progress=<header>
328 Show progress reports on stderr as objects are considered. The
329 <header> text will be printed with each progress update.
330
331 History Simplification
332 Sometimes you are only interested in parts of the history, for example
333 the commits modifying a particular <path>. But there are two parts of
334 History Simplification, one part is selecting the commits and the other
335 is how to do it, as there are various strategies to simplify the
336 history.
337
338 The following options select the commits to be shown:
339
340 <paths>
341 Commits modifying the given <paths> are selected.
342
343 --simplify-by-decoration
344 Commits that are referred by some branch or tag are selected.
345
346 Note that extra commits can be shown to give a meaningful history.
347
348 The following options affect the way the simplification is performed:
349
350 Default mode
351 Simplifies the history to the simplest history explaining the final
352 state of the tree. Simplest because it prunes some side branches if
353 the end result is the same (i.e. merging branches with the same
354 content)
355
356 --show-pulls
357 Include all commits from the default mode, but also any merge
358 commits that are not TREESAME to the first parent but are TREESAME
359 to a later parent. This mode is helpful for showing the merge
360 commits that "first introduced" a change to a branch.
361
362 --full-history
363 Same as the default mode, but does not prune some history.
364
365 --dense
366 Only the selected commits are shown, plus some to have a meaningful
367 history.
368
369 --sparse
370 All commits in the simplified history are shown.
371
372 --simplify-merges
373 Additional option to --full-history to remove some needless merges
374 from the resulting history, as there are no selected commits
375 contributing to this merge.
376
377 --ancestry-path
378 When given a range of commits to display (e.g. commit1..commit2 or
379 commit2 ^commit1), only display commits that exist directly on the
380 ancestry chain between the commit1 and commit2, i.e. commits that
381 are both descendants of commit1, and ancestors of commit2.
382
383 A more detailed explanation follows.
384
385 Suppose you specified foo as the <paths>. We shall call commits that
386 modify foo !TREESAME, and the rest TREESAME. (In a diff filtered for
387 foo, they look different and equal, respectively.)
388
389 In the following, we will always refer to the same example history to
390 illustrate the differences between simplification settings. We assume
391 that you are filtering for a file foo in this commit graph:
392
393 .-A---M---N---O---P---Q
394 / / / / / /
395 I B C D E Y
396 \ / / / / /
397 `-------------' X
398
399 The horizontal line of history A---Q is taken to be the first parent of
400 each merge. The commits are:
401
402 • I is the initial commit, in which foo exists with contents “asdf”,
403 and a file quux exists with contents “quux”. Initial commits are
404 compared to an empty tree, so I is !TREESAME.
405
406 • In A, foo contains just “foo”.
407
408 • B contains the same change as A. Its merge M is trivial and hence
409 TREESAME to all parents.
410
411 • C does not change foo, but its merge N changes it to “foobar”, so
412 it is not TREESAME to any parent.
413
414 • D sets foo to “baz”. Its merge O combines the strings from N and D
415 to “foobarbaz”; i.e., it is not TREESAME to any parent.
416
417 • E changes quux to “xyzzy”, and its merge P combines the strings to
418 “quux xyzzy”. P is TREESAME to O, but not to E.
419
420 • X is an independent root commit that added a new file side, and Y
421 modified it. Y is TREESAME to X. Its merge Q added side to P, and
422 Q is TREESAME to P, but not to Y.
423
424 rev-list walks backwards through history, including or excluding
425 commits based on whether --full-history and/or parent rewriting (via
426 --parents or --children) are used. The following settings are
427 available.
428
429 Default mode
430 Commits are included if they are not TREESAME to any parent (though
431 this can be changed, see --sparse below). If the commit was a
432 merge, and it was TREESAME to one parent, follow only that parent.
433 (Even if there are several TREESAME parents, follow only one of
434 them.) Otherwise, follow all parents.
435
436 This results in:
437
438 .-A---N---O
439 / / /
440 I---------D
441
442 Note how the rule to only follow the TREESAME parent, if one is
443 available, removed B from consideration entirely. C was considered
444 via N, but is TREESAME. Root commits are compared to an empty tree,
445 so I is !TREESAME.
446
447 Parent/child relations are only visible with --parents, but that
448 does not affect the commits selected in default mode, so we have
449 shown the parent lines.
450
451 --full-history without parent rewriting
452 This mode differs from the default in one point: always follow all
453 parents of a merge, even if it is TREESAME to one of them. Even if
454 more than one side of the merge has commits that are included, this
455 does not imply that the merge itself is! In the example, we get
456
457 I A B N D O P Q
458
459 M was excluded because it is TREESAME to both parents. E, C and B
460 were all walked, but only B was !TREESAME, so the others do not
461 appear.
462
463 Note that without parent rewriting, it is not really possible to
464 talk about the parent/child relationships between the commits, so
465 we show them disconnected.
466
467 --full-history with parent rewriting
468 Ordinary commits are only included if they are !TREESAME (though
469 this can be changed, see --sparse below).
470
471 Merges are always included. However, their parent list is
472 rewritten: Along each parent, prune away commits that are not
473 included themselves. This results in
474
475 .-A---M---N---O---P---Q
476 / / / / /
477 I B / D /
478 \ / / / /
479 `-------------'
480
481 Compare to --full-history without rewriting above. Note that E was
482 pruned away because it is TREESAME, but the parent list of P was
483 rewritten to contain E's parent I. The same happened for C and N,
484 and X, Y and Q.
485
486 In addition to the above settings, you can change whether TREESAME
487 affects inclusion:
488
489 --dense
490 Commits that are walked are included if they are not TREESAME to
491 any parent.
492
493 --sparse
494 All commits that are walked are included.
495
496 Note that without --full-history, this still simplifies merges: if
497 one of the parents is TREESAME, we follow only that one, so the
498 other sides of the merge are never walked.
499
500 --simplify-merges
501 First, build a history graph in the same way that --full-history
502 with parent rewriting does (see above).
503
504 Then simplify each commit C to its replacement C' in the final
505 history according to the following rules:
506
507 • Set C' to C.
508
509 • Replace each parent P of C' with its simplification P'. In the
510 process, drop parents that are ancestors of other parents or
511 that are root commits TREESAME to an empty tree, and remove
512 duplicates, but take care to never drop all parents that we are
513 TREESAME to.
514
515 • If after this parent rewriting, C' is a root or merge commit
516 (has zero or >1 parents), a boundary commit, or !TREESAME, it
517 remains. Otherwise, it is replaced with its only parent.
518
519 The effect of this is best shown by way of comparing to
520 --full-history with parent rewriting. The example turns into:
521
522 .-A---M---N---O
523 / / /
524 I B D
525 \ / /
526 `---------'
527
528 Note the major differences in N, P, and Q over --full-history:
529
530 • N's parent list had I removed, because it is an ancestor of the
531 other parent M. Still, N remained because it is !TREESAME.
532
533 • P's parent list similarly had I removed. P was then removed
534 completely, because it had one parent and is TREESAME.
535
536 • Q's parent list had Y simplified to X. X was then removed,
537 because it was a TREESAME root. Q was then removed completely,
538 because it had one parent and is TREESAME.
539
540 There is another simplification mode available:
541
542 --ancestry-path
543 Limit the displayed commits to those directly on the ancestry chain
544 between the “from” and “to” commits in the given commit range. I.e.
545 only display commits that are ancestor of the “to” commit and
546 descendants of the “from” commit.
547
548 As an example use case, consider the following commit history:
549
550 D---E-------F
551 / \ \
552 B---C---G---H---I---J
553 / \
554 A-------K---------------L--M
555
556 A regular D..M computes the set of commits that are ancestors of M,
557 but excludes the ones that are ancestors of D. This is useful to
558 see what happened to the history leading to M since D, in the sense
559 that “what does M have that did not exist in D”. The result in this
560 example would be all the commits, except A and B (and D itself, of
561 course).
562
563 When we want to find out what commits in M are contaminated with
564 the bug introduced by D and need fixing, however, we might want to
565 view only the subset of D..M that are actually descendants of D,
566 i.e. excluding C and K. This is exactly what the --ancestry-path
567 option does. Applied to the D..M range, it results in:
568
569 E-------F
570 \ \
571 G---H---I---J
572 \
573 L--M
574
575 Before discussing another option, --show-pulls, we need to create a new
576 example history.
577
578 A common problem users face when looking at simplified history is that
579 a commit they know changed a file somehow does not appear in the file’s
580 simplified history. Let’s demonstrate a new example and show how
581 options such as --full-history and --simplify-merges works in that
582 case:
583
584 .-A---M-----C--N---O---P
585 / / \ \ \/ / /
586 I B \ R-'`-Z' /
587 \ / \/ /
588 \ / /\ /
589 `---X--' `---Y--'
590
591 For this example, suppose I created file.txt which was modified by A,
592 B, and X in different ways. The single-parent commits C, Z, and Y do
593 not change file.txt. The merge commit M was created by resolving the
594 merge conflict to include both changes from A and B and hence is not
595 TREESAME to either. The merge commit R, however, was created by
596 ignoring the contents of file.txt at M and taking only the contents of
597 file.txt at X. Hence, R is TREESAME to X but not M. Finally, the
598 natural merge resolution to create N is to take the contents of
599 file.txt at R, so N is TREESAME to R but not C. The merge commits O and
600 P are TREESAME to their first parents, but not to their second parents,
601 Z and Y respectively.
602
603 When using the default mode, N and R both have a TREESAME parent, so
604 those edges are walked and the others are ignored. The resulting
605 history graph is:
606
607 I---X
608
609 When using --full-history, Git walks every edge. This will discover the
610 commits A and B and the merge M, but also will reveal the merge commits
611 O and P. With parent rewriting, the resulting graph is:
612
613 .-A---M--------N---O---P
614 / / \ \ \/ / /
615 I B \ R-'`--' /
616 \ / \/ /
617 \ / /\ /
618 `---X--' `------'
619
620 Here, the merge commits O and P contribute extra noise, as they did not
621 actually contribute a change to file.txt. They only merged a topic that
622 was based on an older version of file.txt. This is a common issue in
623 repositories using a workflow where many contributors work in parallel
624 and merge their topic branches along a single trunk: manu unrelated
625 merges appear in the --full-history results.
626
627 When using the --simplify-merges option, the commits O and P disappear
628 from the results. This is because the rewritten second parents of O and
629 P are reachable from their first parents. Those edges are removed and
630 then the commits look like single-parent commits that are TREESAME to
631 their parent. This also happens to the commit N, resulting in a history
632 view as follows:
633
634 .-A---M--.
635 / / \
636 I B R
637 \ / /
638 \ / /
639 `---X--'
640
641 In this view, we see all of the important single-parent changes from A,
642 B, and X. We also see the carefully-resolved merge M and the
643 not-so-carefully-resolved merge R. This is usually enough information
644 to determine why the commits A and B "disappeared" from history in the
645 default view. However, there are a few issues with this approach.
646
647 The first issue is performance. Unlike any previous option, the
648 --simplify-merges option requires walking the entire commit history
649 before returning a single result. This can make the option difficult to
650 use for very large repositories.
651
652 The second issue is one of auditing. When many contributors are working
653 on the same repository, it is important which merge commits introduced
654 a change into an important branch. The problematic merge R above is not
655 likely to be the merge commit that was used to merge into an important
656 branch. Instead, the merge N was used to merge R and X into the
657 important branch. This commit may have information about why the change
658 X came to override the changes from A and B in its commit message.
659
660 --show-pulls
661 In addition to the commits shown in the default history, show each
662 merge commit that is not TREESAME to its first parent but is
663 TREESAME to a later parent.
664
665 When a merge commit is included by --show-pulls, the merge is
666 treated as if it "pulled" the change from another branch. When
667 using --show-pulls on this example (and no other options) the
668 resulting graph is:
669
670 I---X---R---N
671
672 Here, the merge commits R and N are included because they pulled
673 the commits X and R into the base branch, respectively. These
674 merges are the reason the commits A and B do not appear in the
675 default history.
676
677 When --show-pulls is paired with --simplify-merges, the graph
678 includes all of the necessary information:
679
680 .-A---M--. N
681 / / \ /
682 I B R
683 \ / /
684 \ / /
685 `---X--'
686
687 Notice that since M is reachable from R, the edge from N to M was
688 simplified away. However, N still appears in the history as an
689 important commit because it "pulled" the change R into the main
690 branch.
691
692 The --simplify-by-decoration option allows you to view only the big
693 picture of the topology of the history, by omitting commits that are
694 not referenced by tags. Commits are marked as !TREESAME (in other
695 words, kept after history simplification rules described above) if (1)
696 they are referenced by tags, or (2) they change the contents of the
697 paths given on the command line. All other commits are marked as
698 TREESAME (subject to be simplified away).
699
700 Bisection Helpers
701 --bisect
702 Limit output to the one commit object which is roughly halfway
703 between included and excluded commits. Note that the bad bisection
704 ref refs/bisect/bad is added to the included commits (if it exists)
705 and the good bisection refs refs/bisect/good-* are added to the
706 excluded commits (if they exist). Thus, supposing there are no refs
707 in refs/bisect/, if
708
709 $ git rev-list --bisect foo ^bar ^baz
710
711 outputs midpoint, the output of the two commands
712
713 $ git rev-list foo ^midpoint
714 $ git rev-list midpoint ^bar ^baz
715
716 would be of roughly the same length. Finding the change which
717 introduces a regression is thus reduced to a binary search:
718 repeatedly generate and test new 'midpoint’s until the commit chain
719 is of length one.
720
721 --bisect-vars
722 This calculates the same as --bisect, except that refs in
723 refs/bisect/ are not used, and except that this outputs text ready
724 to be eval’ed by the shell. These lines will assign the name of the
725 midpoint revision to the variable bisect_rev, and the expected
726 number of commits to be tested after bisect_rev is tested to
727 bisect_nr, the expected number of commits to be tested if
728 bisect_rev turns out to be good to bisect_good, the expected number
729 of commits to be tested if bisect_rev turns out to be bad to
730 bisect_bad, and the number of commits we are bisecting right now to
731 bisect_all.
732
733 --bisect-all
734 This outputs all the commit objects between the included and
735 excluded commits, ordered by their distance to the included and
736 excluded commits. Refs in refs/bisect/ are not used. The farthest
737 from them is displayed first. (This is the only one displayed by
738 --bisect.)
739
740 This is useful because it makes it easy to choose a good commit to
741 test when you want to avoid to test some of them for some reason
742 (they may not compile for example).
743
744 This option can be used along with --bisect-vars, in this case,
745 after all the sorted commit objects, there will be the same text as
746 if --bisect-vars had been used alone.
747
748 Commit Ordering
749 By default, the commits are shown in reverse chronological order.
750
751 --date-order
752 Show no parents before all of its children are shown, but otherwise
753 show commits in the commit timestamp order.
754
755 --author-date-order
756 Show no parents before all of its children are shown, but otherwise
757 show commits in the author timestamp order.
758
759 --topo-order
760 Show no parents before all of its children are shown, and avoid
761 showing commits on multiple lines of history intermixed.
762
763 For example, in a commit history like this:
764
765 ---1----2----4----7
766 \ \
767 3----5----6----8---
768
769 where the numbers denote the order of commit timestamps, git
770 rev-list and friends with --date-order show the commits in the
771 timestamp order: 8 7 6 5 4 3 2 1.
772
773 With --topo-order, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
774 3 1); some older commits are shown before newer ones in order to
775 avoid showing the commits from two parallel development track mixed
776 together.
777
778 --reverse
779 Output the commits chosen to be shown (see Commit Limiting section
780 above) in reverse order. Cannot be combined with --walk-reflogs.
781
782 Object Traversal
783 These options are mostly targeted for packing of Git repositories.
784
785 --objects
786 Print the object IDs of any object referenced by the listed
787 commits. --objects foo ^bar thus means “send me all object IDs
788 which I need to download if I have the commit object bar but not
789 foo”.
790
791 --in-commit-order
792 Print tree and blob ids in order of the commits. The tree and blob
793 ids are printed after they are first referenced by a commit.
794
795 --objects-edge
796 Similar to --objects, but also print the IDs of excluded commits
797 prefixed with a “-” character. This is used by git-pack-objects(1)
798 to build a “thin” pack, which records objects in deltified form
799 based on objects contained in these excluded commits to reduce
800 network traffic.
801
802 --objects-edge-aggressive
803 Similar to --objects-edge, but it tries harder to find excluded
804 commits at the cost of increased time. This is used instead of
805 --objects-edge to build “thin” packs for shallow repositories.
806
807 --indexed-objects
808 Pretend as if all trees and blobs used by the index are listed on
809 the command line. Note that you probably want to use --objects,
810 too.
811
812 --unpacked
813 Only useful with --objects; print the object IDs that are not in
814 packs.
815
816 --object-names
817 Only useful with --objects; print the names of the object IDs that
818 are found. This is the default behavior.
819
820 --no-object-names
821 Only useful with --objects; does not print the names of the object
822 IDs that are found. This inverts --object-names. This flag allows
823 the output to be more easily parsed by commands such as git-cat-
824 file(1).
825
826 --filter=<filter-spec>
827 Only useful with one of the --objects*; omits objects (usually
828 blobs) from the list of printed objects. The <filter-spec> may be
829 one of the following:
830
831 The form --filter=blob:none omits all blobs.
832
833 The form --filter=blob:limit=<n>[kmg] omits blobs larger than n
834 bytes or units. n may be zero. The suffixes k, m, and g can be used
835 to name units in KiB, MiB, or GiB. For example, blob:limit=1k is
836 the same as blob:limit=1024.
837
838 The form --filter=object:type=(tag|commit|tree|blob) omits all
839 objects which are not of the requested type.
840
841 The form --filter=sparse:oid=<blob-ish> uses a sparse-checkout
842 specification contained in the blob (or blob-expression) <blob-ish>
843 to omit blobs that would not be required for a sparse checkout on
844 the requested refs.
845
846 The form --filter=tree:<depth> omits all blobs and trees whose
847 depth from the root tree is >= <depth> (minimum depth if an object
848 is located at multiple depths in the commits traversed). <depth>=0
849 will not include any trees or blobs unless included explicitly in
850 the command-line (or standard input when --stdin is used).
851 <depth>=1 will include only the tree and blobs which are referenced
852 directly by a commit reachable from <commit> or an explicitly-given
853 object. <depth>=2 is like <depth>=1 while also including trees and
854 blobs one more level removed from an explicitly-given commit or
855 tree.
856
857 Note that the form --filter=sparse:path=<path> that wants to read
858 from an arbitrary path on the filesystem has been dropped for
859 security reasons.
860
861 Multiple --filter= flags can be specified to combine filters. Only
862 objects which are accepted by every filter are included.
863
864 The form --filter=combine:<filter1>+<filter2>+...<filterN> can also
865 be used to combined several filters, but this is harder than just
866 repeating the --filter flag and is usually not necessary. Filters
867 are joined by + and individual filters are %-encoded (i.e.
868 URL-encoded). Besides the + and % characters, the following
869 characters are reserved and also must be encoded:
870 ~!@#$^&*()[]{}\;",<>?'` as well as all characters with ASCII code
871 <= 0x20, which includes space and newline.
872
873 Other arbitrary characters can also be encoded. For instance,
874 combine:tree:3+blob:none and combine:tree%3A3+blob%3Anone are
875 equivalent.
876
877 --no-filter
878 Turn off any previous --filter= argument.
879
880 --filter-provided-objects
881 Filter the list of explicitly provided objects, which would
882 otherwise always be printed even if they did not match any of the
883 filters. Only useful with --filter=.
884
885 --filter-print-omitted
886 Only useful with --filter=; prints a list of the objects omitted by
887 the filter. Object IDs are prefixed with a “~” character.
888
889 --missing=<missing-action>
890 A debug option to help with future "partial clone" development.
891 This option specifies how missing objects are handled.
892
893 The form --missing=error requests that rev-list stop with an error
894 if a missing object is encountered. This is the default action.
895
896 The form --missing=allow-any will allow object traversal to
897 continue if a missing object is encountered. Missing objects will
898 silently be omitted from the results.
899
900 The form --missing=allow-promisor is like allow-any, but will only
901 allow object traversal to continue for EXPECTED promisor missing
902 objects. Unexpected missing objects will raise an error.
903
904 The form --missing=print is like allow-any, but will also print a
905 list of the missing objects. Object IDs are prefixed with a “?”
906 character.
907
908 --exclude-promisor-objects
909 (For internal use only.) Prefilter object traversal at promisor
910 boundary. This is used with partial clone. This is stronger than
911 --missing=allow-promisor because it limits the traversal, rather
912 than just silencing errors about missing objects.
913
914 --no-walk[=(sorted|unsorted)]
915 Only show the given commits, but do not traverse their ancestors.
916 This has no effect if a range is specified. If the argument
917 unsorted is given, the commits are shown in the order they were
918 given on the command line. Otherwise (if sorted or no argument was
919 given), the commits are shown in reverse chronological order by
920 commit time. Cannot be combined with --graph.
921
922 --do-walk
923 Overrides a previous --no-walk.
924
925 Commit Formatting
926 Using these options, git-rev-list(1) will act similar to the more
927 specialized family of commit log tools: git-log(1), git-show(1), and
928 git-whatchanged(1)
929
930 --pretty[=<format>], --format=<format>
931 Pretty-print the contents of the commit logs in a given format,
932 where <format> can be one of oneline, short, medium, full, fuller,
933 reference, email, raw, format:<string> and tformat:<string>. When
934 <format> is none of the above, and has %placeholder in it, it acts
935 as if --pretty=tformat:<format> were given.
936
937 See the "PRETTY FORMATS" section for some additional details for
938 each format. When =<format> part is omitted, it defaults to medium.
939
940 Note: you can specify the default pretty format in the repository
941 configuration (see git-config(1)).
942
943 --abbrev-commit
944 Instead of showing the full 40-byte hexadecimal commit object name,
945 show a prefix that names the object uniquely. "--abbrev=<n>" (which
946 also modifies diff output, if it is displayed) option can be used
947 to specify the minimum length of the prefix.
948
949 This should make "--pretty=oneline" a whole lot more readable for
950 people using 80-column terminals.
951
952 --no-abbrev-commit
953 Show the full 40-byte hexadecimal commit object name. This negates
954 --abbrev-commit, either explicit or implied by other options such
955 as "--oneline". It also overrides the log.abbrevCommit variable.
956
957 --oneline
958 This is a shorthand for "--pretty=oneline --abbrev-commit" used
959 together.
960
961 --encoding=<encoding>
962 Commit objects record the character encoding used for the log
963 message in their encoding header; this option can be used to tell
964 the command to re-code the commit log message in the encoding
965 preferred by the user. For non plumbing commands this defaults to
966 UTF-8. Note that if an object claims to be encoded in X and we are
967 outputting in X, we will output the object verbatim; this means
968 that invalid sequences in the original commit may be copied to the
969 output. Likewise, if iconv(3) fails to convert the commit, we will
970 output the original object verbatim, along with a warning.
971
972 --expand-tabs=<n>, --expand-tabs, --no-expand-tabs
973 Perform a tab expansion (replace each tab with enough spaces to
974 fill to the next display column that is multiple of <n>) in the log
975 message before showing it in the output. --expand-tabs is a
976 short-hand for --expand-tabs=8, and --no-expand-tabs is a
977 short-hand for --expand-tabs=0, which disables tab expansion.
978
979 By default, tabs are expanded in pretty formats that indent the log
980 message by 4 spaces (i.e. medium, which is the default, full, and
981 fuller).
982
983 --show-signature
984 Check the validity of a signed commit object by passing the
985 signature to gpg --verify and show the output.
986
987 --relative-date
988 Synonym for --date=relative.
989
990 --date=<format>
991 Only takes effect for dates shown in human-readable format, such as
992 when using --pretty. log.date config variable sets a default value
993 for the log command’s --date option. By default, dates are shown in
994 the original time zone (either committer’s or author’s). If -local
995 is appended to the format (e.g., iso-local), the user’s local time
996 zone is used instead.
997
998 --date=relative shows dates relative to the current time, e.g. “2
999 hours ago”. The -local option has no effect for --date=relative.
1000
1001 --date=local is an alias for --date=default-local.
1002
1003 --date=iso (or --date=iso8601) shows timestamps in a ISO 8601-like
1004 format. The differences to the strict ISO 8601 format are:
1005
1006 • a space instead of the T date/time delimiter
1007
1008 • a space between time and time zone
1009
1010 • no colon between hours and minutes of the time zone
1011
1012 --date=iso-strict (or --date=iso8601-strict) shows timestamps in
1013 strict ISO 8601 format.
1014
1015 --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format,
1016 often found in email messages.
1017
1018 --date=short shows only the date, but not the time, in YYYY-MM-DD
1019 format.
1020
1021 --date=raw shows the date as seconds since the epoch (1970-01-01
1022 00:00:00 UTC), followed by a space, and then the timezone as an
1023 offset from UTC (a + or - with four digits; the first two are
1024 hours, and the second two are minutes). I.e., as if the timestamp
1025 were formatted with strftime("%s %z")). Note that the -local option
1026 does not affect the seconds-since-epoch value (which is always
1027 measured in UTC), but does switch the accompanying timezone value.
1028
1029 --date=human shows the timezone if the timezone does not match the
1030 current time-zone, and doesn’t print the whole date if that matches
1031 (ie skip printing year for dates that are "this year", but also
1032 skip the whole date itself if it’s in the last few days and we can
1033 just say what weekday it was). For older dates the hour and minute
1034 is also omitted.
1035
1036 --date=unix shows the date as a Unix epoch timestamp (seconds since
1037 1970). As with --raw, this is always in UTC and therefore -local
1038 has no effect.
1039
1040 --date=format:... feeds the format ... to your system strftime,
1041 except for %z and %Z, which are handled internally. Use
1042 --date=format:%c to show the date in your system locale’s preferred
1043 format. See the strftime manual for a complete list of format
1044 placeholders. When using -local, the correct syntax is
1045 --date=format-local:....
1046
1047 --date=default is the default format, and is similar to
1048 --date=rfc2822, with a few exceptions:
1049
1050 • there is no comma after the day-of-week
1051
1052 • the time zone is omitted when the local time zone is used
1053
1054 --header
1055 Print the contents of the commit in raw-format; each record is
1056 separated with a NUL character.
1057
1058 --no-commit-header
1059 Suppress the header line containing "commit" and the object ID
1060 printed before the specified format. This has no effect on the
1061 built-in formats; only custom formats are affected.
1062
1063 --commit-header
1064 Overrides a previous --no-commit-header.
1065
1066 --parents
1067 Print also the parents of the commit (in the form "commit parent...
1068 "). Also enables parent rewriting, see History Simplification
1069 above.
1070
1071 --children
1072 Print also the children of the commit (in the form "commit child...
1073 "). Also enables parent rewriting, see History Simplification
1074 above.
1075
1076 --timestamp
1077 Print the raw commit timestamp.
1078
1079 --left-right
1080 Mark which side of a symmetric difference a commit is reachable
1081 from. Commits from the left side are prefixed with < and those from
1082 the right with >. If combined with --boundary, those commits are
1083 prefixed with -.
1084
1085 For example, if you have this topology:
1086
1087 y---b---b branch B
1088 / \ /
1089 / .
1090 / / \
1091 o---x---a---a branch A
1092
1093 you would get an output like this:
1094
1095 $ git rev-list --left-right --boundary --pretty=oneline A...B
1096
1097 >bbbbbbb... 3rd on b
1098 >bbbbbbb... 2nd on b
1099 <aaaaaaa... 3rd on a
1100 <aaaaaaa... 2nd on a
1101 -yyyyyyy... 1st on b
1102 -xxxxxxx... 1st on a
1103
1104 --graph
1105 Draw a text-based graphical representation of the commit history on
1106 the left hand side of the output. This may cause extra lines to be
1107 printed in between commits, in order for the graph history to be
1108 drawn properly. Cannot be combined with --no-walk.
1109
1110 This enables parent rewriting, see History Simplification above.
1111
1112 This implies the --topo-order option by default, but the
1113 --date-order option may also be specified.
1114
1115 --show-linear-break[=<barrier>]
1116 When --graph is not used, all history branches are flattened which
1117 can make it hard to see that the two consecutive commits do not
1118 belong to a linear branch. This option puts a barrier in between
1119 them in that case. If <barrier> is specified, it is the string that
1120 will be shown instead of the default one.
1121
1122 --count
1123 Print a number stating how many commits would have been listed, and
1124 suppress all other output. When used together with --left-right,
1125 instead print the counts for left and right commits, separated by a
1126 tab. When used together with --cherry-mark, omit patch equivalent
1127 commits from these counts and print the count for equivalent
1128 commits separated by a tab.
1129
1131 If the commit is a merge, and if the pretty-format is not oneline,
1132 email or raw, an additional line is inserted before the Author: line.
1133 This line begins with "Merge: " and the hashes of ancestral commits are
1134 printed, separated by spaces. Note that the listed commits may not
1135 necessarily be the list of the direct parent commits if you have
1136 limited your view of history: for example, if you are only interested
1137 in changes related to a certain directory or file.
1138
1139 There are several built-in formats, and you can define additional
1140 formats by setting a pretty.<name> config option to either another
1141 format name, or a format: string, as described below (see git-
1142 config(1)). Here are the details of the built-in formats:
1143
1144 • oneline
1145
1146 <hash> <title line>
1147
1148 This is designed to be as compact as possible.
1149
1150 • short
1151
1152 commit <hash>
1153 Author: <author>
1154
1155 <title line>
1156
1157 • medium
1158
1159 commit <hash>
1160 Author: <author>
1161 Date: <author date>
1162
1163 <title line>
1164
1165 <full commit message>
1166
1167 • full
1168
1169 commit <hash>
1170 Author: <author>
1171 Commit: <committer>
1172
1173 <title line>
1174
1175 <full commit message>
1176
1177 • fuller
1178
1179 commit <hash>
1180 Author: <author>
1181 AuthorDate: <author date>
1182 Commit: <committer>
1183 CommitDate: <committer date>
1184
1185 <title line>
1186
1187 <full commit message>
1188
1189 • reference
1190
1191 <abbrev hash> (<title line>, <short author date>)
1192
1193 This format is used to refer to another commit in a commit message
1194 and is the same as --pretty='format:%C(auto)%h (%s, %ad)'. By
1195 default, the date is formatted with --date=short unless another
1196 --date option is explicitly specified. As with any format: with
1197 format placeholders, its output is not affected by other options
1198 like --decorate and --walk-reflogs.
1199
1200 • email
1201
1202 From <hash> <date>
1203 From: <author>
1204 Date: <author date>
1205 Subject: [PATCH] <title line>
1206
1207 <full commit message>
1208
1209 • mboxrd
1210
1211 Like email, but lines in the commit message starting with "From "
1212 (preceded by zero or more ">") are quoted with ">" so they aren’t
1213 confused as starting a new commit.
1214
1215 • raw
1216
1217 The raw format shows the entire commit exactly as stored in the
1218 commit object. Notably, the hashes are displayed in full,
1219 regardless of whether --abbrev or --no-abbrev are used, and parents
1220 information show the true parent commits, without taking grafts or
1221 history simplification into account. Note that this format affects
1222 the way commits are displayed, but not the way the diff is shown
1223 e.g. with git log --raw. To get full object names in a raw diff
1224 format, use --no-abbrev.
1225
1226 • format:<string>
1227
1228 The format:<string> format allows you to specify which information
1229 you want to show. It works a little bit like printf format, with
1230 the notable exception that you get a newline with %n instead of \n.
1231
1232 E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
1233 would show something like this:
1234
1235 The author of fe6e0ee was Junio C Hamano, 23 hours ago
1236 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
1237
1238 The placeholders are:
1239
1240 • Placeholders that expand to a single literal character:
1241
1242 %n
1243 newline
1244
1245 %%
1246 a raw %
1247
1248 %x00
1249 print a byte from a hex code
1250
1251 • Placeholders that affect formatting of later placeholders:
1252
1253 %Cred
1254 switch color to red
1255
1256 %Cgreen
1257 switch color to green
1258
1259 %Cblue
1260 switch color to blue
1261
1262 %Creset
1263 reset color
1264
1265 %C(...)
1266 color specification, as described under Values in the
1267 "CONFIGURATION FILE" section of git-config(1). By default,
1268 colors are shown only when enabled for log output (by
1269 color.diff, color.ui, or --color, and respecting the auto
1270 settings of the former if we are going to a terminal).
1271 %C(auto,...) is accepted as a historical synonym for the
1272 default (e.g., %C(auto,red)). Specifying %C(always,...)
1273 will show the colors even when color is not otherwise
1274 enabled (though consider just using --color=always to
1275 enable color for the whole output, including this format
1276 and anything else git might color). auto alone (i.e.
1277 %C(auto)) will turn on auto coloring on the next
1278 placeholders until the color is switched again.
1279
1280 %m
1281 left (<), right (>) or boundary (-) mark
1282
1283 %w([<w>[,<i1>[,<i2>]]])
1284 switch line wrapping, like the -w option of git-
1285 shortlog(1).
1286
1287 %<(<N>[,trunc|ltrunc|mtrunc])
1288 make the next placeholder take at least N columns, padding
1289 spaces on the right if necessary. Optionally truncate at
1290 the beginning (ltrunc), the middle (mtrunc) or the end
1291 (trunc) if the output is longer than N columns. Note that
1292 truncating only works correctly with N >= 2.
1293
1294 %<|(<N>)
1295 make the next placeholder take at least until Nth columns,
1296 padding spaces on the right if necessary
1297
1298 %>(<N>), %>|(<N>)
1299 similar to %<(<N>), %<|(<N>) respectively, but padding
1300 spaces on the left
1301
1302 %>>(<N>), %>>|(<N>)
1303 similar to %>(<N>), %>|(<N>) respectively, except that if
1304 the next placeholder takes more spaces than given and there
1305 are spaces on its left, use those spaces
1306
1307 %><(<N>), %><|(<N>)
1308 similar to %<(<N>), %<|(<N>) respectively, but padding both
1309 sides (i.e. the text is centered)
1310
1311 • Placeholders that expand to information extracted from the
1312 commit:
1313
1314 %H
1315 commit hash
1316
1317 %h
1318 abbreviated commit hash
1319
1320 %T
1321 tree hash
1322
1323 %t
1324 abbreviated tree hash
1325
1326 %P
1327 parent hashes
1328
1329 %p
1330 abbreviated parent hashes
1331
1332 %an
1333 author name
1334
1335 %aN
1336 author name (respecting .mailmap, see git-shortlog(1) or
1337 git-blame(1))
1338
1339 %ae
1340 author email
1341
1342 %aE
1343 author email (respecting .mailmap, see git-shortlog(1) or
1344 git-blame(1))
1345
1346 %al
1347 author email local-part (the part before the @ sign)
1348
1349 %aL
1350 author local-part (see %al) respecting .mailmap, see git-
1351 shortlog(1) or git-blame(1))
1352
1353 %ad
1354 author date (format respects --date= option)
1355
1356 %aD
1357 author date, RFC2822 style
1358
1359 %ar
1360 author date, relative
1361
1362 %at
1363 author date, UNIX timestamp
1364
1365 %ai
1366 author date, ISO 8601-like format
1367
1368 %aI
1369 author date, strict ISO 8601 format
1370
1371 %as
1372 author date, short format (YYYY-MM-DD)
1373
1374 %ah
1375 author date, human style (like the --date=human option of
1376 git-rev-list(1))
1377
1378 %cn
1379 committer name
1380
1381 %cN
1382 committer name (respecting .mailmap, see git-shortlog(1) or
1383 git-blame(1))
1384
1385 %ce
1386 committer email
1387
1388 %cE
1389 committer email (respecting .mailmap, see git-shortlog(1)
1390 or git-blame(1))
1391
1392 %cl
1393 committer email local-part (the part before the @ sign)
1394
1395 %cL
1396 committer local-part (see %cl) respecting .mailmap, see
1397 git-shortlog(1) or git-blame(1))
1398
1399 %cd
1400 committer date (format respects --date= option)
1401
1402 %cD
1403 committer date, RFC2822 style
1404
1405 %cr
1406 committer date, relative
1407
1408 %ct
1409 committer date, UNIX timestamp
1410
1411 %ci
1412 committer date, ISO 8601-like format
1413
1414 %cI
1415 committer date, strict ISO 8601 format
1416
1417 %cs
1418 committer date, short format (YYYY-MM-DD)
1419
1420 %ch
1421 committer date, human style (like the --date=human option
1422 of git-rev-list(1))
1423
1424 %d
1425 ref names, like the --decorate option of git-log(1)
1426
1427 %D
1428 ref names without the " (", ")" wrapping.
1429
1430 %(describe[:options])
1431 human-readable name, like git-describe(1); empty string for
1432 undescribable commits. The describe string may be followed
1433 by a colon and zero or more comma-separated options.
1434 Descriptions can be inconsistent when tags are added or
1435 removed at the same time.
1436
1437 • match=<pattern>: Only consider tags matching the given
1438 glob(7) pattern, excluding the "refs/tags/" prefix.
1439
1440 • exclude=<pattern>: Do not consider tags matching the
1441 given glob(7) pattern, excluding the "refs/tags/"
1442 prefix.
1443
1444 %S
1445 ref name given on the command line by which the commit was
1446 reached (like git log --source), only works with git log
1447
1448 %e
1449 encoding
1450
1451 %s
1452 subject
1453
1454 %f
1455 sanitized subject line, suitable for a filename
1456
1457 %b
1458 body
1459
1460 %B
1461 raw body (unwrapped subject and body)
1462
1463 %GG
1464 raw verification message from GPG for a signed commit
1465
1466 %G?
1467 show "G" for a good (valid) signature, "B" for a bad
1468 signature, "U" for a good signature with unknown validity,
1469 "X" for a good signature that has expired, "Y" for a good
1470 signature made by an expired key, "R" for a good signature
1471 made by a revoked key, "E" if the signature cannot be
1472 checked (e.g. missing key) and "N" for no signature
1473
1474 %GS
1475 show the name of the signer for a signed commit
1476
1477 %GK
1478 show the key used to sign a signed commit
1479
1480 %GF
1481 show the fingerprint of the key used to sign a signed
1482 commit
1483
1484 %GP
1485 show the fingerprint of the primary key whose subkey was
1486 used to sign a signed commit
1487
1488 %GT
1489 show the trust level for the key used to sign a signed
1490 commit
1491
1492 %gD
1493 reflog selector, e.g., refs/stash@{1} or refs/stash@{2
1494 minutes ago}; the format follows the rules described for
1495 the -g option. The portion before the @ is the refname as
1496 given on the command line (so git log -g refs/heads/master
1497 would yield refs/heads/master@{0}).
1498
1499 %gd
1500 shortened reflog selector; same as %gD, but the refname
1501 portion is shortened for human readability (so
1502 refs/heads/master becomes just master).
1503
1504 %gn
1505 reflog identity name
1506
1507 %gN
1508 reflog identity name (respecting .mailmap, see git-
1509 shortlog(1) or git-blame(1))
1510
1511 %ge
1512 reflog identity email
1513
1514 %gE
1515 reflog identity email (respecting .mailmap, see git-
1516 shortlog(1) or git-blame(1))
1517
1518 %gs
1519 reflog subject
1520
1521 %(trailers[:options])
1522 display the trailers of the body as interpreted by git-
1523 interpret-trailers(1). The trailers string may be followed
1524 by a colon and zero or more comma-separated options. If any
1525 option is provided multiple times the last occurrence wins.
1526
1527 The boolean options accept an optional value [=<BOOL>]. The
1528 values true, false, on, off etc. are all accepted. See the
1529 "boolean" sub-section in "EXAMPLES" in git-config(1). If a
1530 boolean option is given with no value, it’s enabled.
1531
1532 • key=<K>: only show trailers with specified key.
1533 Matching is done case-insensitively and trailing colon
1534 is optional. If option is given multiple times trailer
1535 lines matching any of the keys are shown. This option
1536 automatically enables the only option so that
1537 non-trailer lines in the trailer block are hidden. If
1538 that is not desired it can be disabled with only=false.
1539 E.g., %(trailers:key=Reviewed-by) shows trailer lines
1540 with key Reviewed-by.
1541
1542 • only[=<BOOL>]: select whether non-trailer lines from
1543 the trailer block should be included.
1544
1545 • separator=<SEP>: specify a separator inserted between
1546 trailer lines. When this option is not given each
1547 trailer line is terminated with a line feed character.
1548 The string SEP may contain the literal formatting codes
1549 described above. To use comma as separator one must use
1550 %x2C as it would otherwise be parsed as next option.
1551 E.g., %(trailers:key=Ticket,separator=%x2C ) shows all
1552 trailer lines whose key is "Ticket" separated by a
1553 comma and a space.
1554
1555 • unfold[=<BOOL>]: make it behave as if
1556 interpret-trailer’s --unfold option was given. E.g.,
1557 %(trailers:only,unfold=true) unfolds and shows all
1558 trailer lines.
1559
1560 • keyonly[=<BOOL>]: only show the key part of the
1561 trailer.
1562
1563 • valueonly[=<BOOL>]: only show the value part of the
1564 trailer.
1565
1566 • key_value_separator=<SEP>: specify a separator inserted
1567 between trailer lines. When this option is not given
1568 each trailer key-value pair is separated by ": ".
1569 Otherwise it shares the same semantics as
1570 separator=<SEP> above.
1571
1572 Note
1573 Some placeholders may depend on other options given to the revision
1574 traversal engine. For example, the %g* reflog options will insert
1575 an empty string unless we are traversing reflog entries (e.g., by
1576 git log -g). The %d and %D placeholders will use the "short"
1577 decoration format if --decorate was not already provided on the
1578 command line.
1579
1580 If you add a + (plus sign) after % of a placeholder, a line-feed is
1581 inserted immediately before the expansion if and only if the
1582 placeholder expands to a non-empty string.
1583
1584 If you add a - (minus sign) after % of a placeholder, all consecutive
1585 line-feeds immediately preceding the expansion are deleted if and only
1586 if the placeholder expands to an empty string.
1587
1588 If you add a ` ` (space) after % of a placeholder, a space is inserted
1589 immediately before the expansion if and only if the placeholder expands
1590 to a non-empty string.
1591
1592 • tformat:
1593
1594 The tformat: format works exactly like format:, except that it
1595 provides "terminator" semantics instead of "separator" semantics.
1596 In other words, each commit has the message terminator character
1597 (usually a newline) appended, rather than a separator placed
1598 between entries. This means that the final entry of a single-line
1599 format will be properly terminated with a new line, just as the
1600 "oneline" format does. For example:
1601
1602 $ git log -2 --pretty=format:%h 4da45bef \
1603 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1604 4da45be
1605 7134973 -- NO NEWLINE
1606
1607 $ git log -2 --pretty=tformat:%h 4da45bef \
1608 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1609 4da45be
1610 7134973
1611
1612 In addition, any unrecognized string that has a % in it is
1613 interpreted as if it has tformat: in front of it. For example,
1614 these two are equivalent:
1615
1616 $ git log -2 --pretty=tformat:%h 4da45bef
1617 $ git log -2 --pretty=%h 4da45bef
1618
1620 • Print the list of commits reachable from the current branch.
1621
1622 git rev-list HEAD
1623
1624 • Print the list of commits on this branch, but not present in the
1625 upstream branch.
1626
1627 git rev-list @{upstream}..HEAD
1628
1629 • Format commits with their author and commit message (see also the
1630 porcelain git-log(1)).
1631
1632 git rev-list --format=medium HEAD
1633
1634 • Format commits along with their diffs (see also the porcelain git-
1635 log(1), which can do this in a single process).
1636
1637 git rev-list HEAD |
1638 git diff-tree --stdin --format=medium -p
1639
1640 • Print the list of commits on the current branch that touched any
1641 file in the Documentation directory.
1642
1643 git rev-list HEAD -- Documentation/
1644
1645 • Print the list of commits authored by you in the past year, on any
1646 branch, tag, or other ref.
1647
1648 git rev-list --author=you@example.com --since=1.year.ago --all
1649
1650 • Print the list of objects reachable from the current branch (i.e.,
1651 all commits and the blobs and trees they contain).
1652
1653 git rev-list --objects HEAD
1654
1655 • Compare the disk size of all reachable objects, versus those
1656 reachable from reflogs, versus the total packed size. This can tell
1657 you whether running git repack -ad might reduce the repository size
1658 (by dropping unreachable objects), and whether expiring reflogs
1659 might help.
1660
1661 # reachable objects
1662 git rev-list --disk-usage --objects --all
1663 # plus reflogs
1664 git rev-list --disk-usage --objects --all --reflog
1665 # total disk size used
1666 du -c .git/objects/pack/*.pack .git/objects/??/*
1667 # alternative to du: add up "size" and "size-pack" fields
1668 git count-objects -v
1669
1670 • Report the disk size of each branch, not including objects used by
1671 the current branch. This can find outliers that are contributing to
1672 a bloated repository size (e.g., because somebody accidentally
1673 committed large build artifacts).
1674
1675 git for-each-ref --format='%(refname)' |
1676 while read branch
1677 do
1678 size=$(git rev-list --disk-usage --objects HEAD..$branch)
1679 echo "$size $branch"
1680 done |
1681 sort -n
1682
1683 • Compare the on-disk size of branches in one group of refs,
1684 excluding another. If you co-mingle objects from multiple remotes
1685 in a single repository, this can show which remotes are
1686 contributing to the repository size (taking the size of origin as a
1687 baseline).
1688
1689 git rev-list --disk-usage --objects --remotes=$suspect --not --remotes=origin
1690
1692 Part of the git(1) suite
1693
1694
1695
1696Git 2.33.1 2021-10-12 GIT-REV-LIST(1)