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 [ --max-count=number ]
10 [ --skip=number ]
11 [ --max-age=timestamp ]
12 [ --min-age=timestamp ]
13 [ --sparse ]
14 [ --no-merges ]
15 [ --remove-empty ]
16 [ --full-history ]
17 [ --not ]
18 [ --all ]
19 [ --stdin ]
20 [ --topo-order ]
21 [ --parents ]
22 [ --timestamp ]
23 [ --left-right ]
24 [ --cherry-pick ]
25 [ --encoding[=<encoding>] ]
26 [ --(author|committer|grep)=<pattern> ]
27 [ --regexp-ignore-case | \-i ]
28 [ --extended-regexp | \-E ]
29 [ --date={local|relative|default|iso|rfc|short} ]
30 [ [--objects | --objects-edge] [ --unpacked ] ]
31 [ --pretty | --header ]
32 [ --bisect ]
33 [ --bisect-vars ]
34 [ --merge ]
35 [ --reverse ]
36 [ --walk-reflogs ]
37 [ --no-walk ] [ --do-walk ]
38 <commit>... [ -- <paths>... ]
39
41 Lists commit objects in reverse chronological order starting at the
42 given commit(s), taking ancestry relationship into account. This is
43 useful to produce human-readable log output.
44
45 Commits which are stated with a preceding ^ cause listing to stop at
46 that point. Their parents are implied. Thus the following command:
47
48
49
50 $ git-rev-list foo bar ^baz
51
52 means "list all the commits which are included in foo and bar, but not
53 in baz".
54
55 A special notation "<commit1>..<commit2>" can be used as a short-hand
56 for "^<commit1> <commit2>". For example, either of the following may be
57 used interchangeably:
58
59
60
61 $ git-rev-list origin..HEAD
62 $ git-rev-list HEAD ^origin
63
64 Another special notation is "<commit1>...<commit2>" which is useful for
65 merges. The resulting set of commits is the symmetric difference
66 between the two operands. The following two commands are equivalent:
67
68
69
70 $ git-rev-list A B --not $(git-merge-base --all A B)
71 $ git-rev-list A...B
72
73 git-rev-list(1) is a very essential git program, since it provides the
74 ability to build and traverse commit ancestry graphs. For this reason,
75 it has a lot of different options that enables it to be used by
76 commands as different as git-bisect(1) and git-repack(1).
77
79 Commit Formatting
80 Using these options, git-rev-list(1) will act similar to the more
81 specialized family of commit log tools: git-log(1), git-show(1), and
82 git-whatchanged(1)
83
84 --pretty[=<format>]
85 Pretty-print the contents of the commit logs in a given format,
86 where <format> can be one of oneline, short, medium, full, fuller,
87 email, raw and format:<string>. When omitted, the format defaults
88 to medium.
89
90 --abbrev-commit
91 Instead of showing the full 40-byte hexadecimal commit object name,
92 show only handful hexdigits prefix. Non default number of digits
93 can be specified with "--abbrev=<n>" (which also modifies diff
94 output, if it is displayed).
95
96 This should make "--pretty=oneline" a whole lot more readable for
97 people using 80-column terminals.
98
99 --encoding[=<encoding>]
100 The commit objects record the encoding used for the log message in
101 their encoding header; this option can be used to tell the command
102 to re-code the commit log message in the encoding preferred by the
103 user. For non plumbing commands this defaults to UTF-8.
104
105 --relative-date
106 Synonym for --date=relative.
107
108 --date={relative,local,default,iso,rfc}
109 Only takes effect for dates shown in human-readable format, such as
110 when using "--pretty".
111
112 --date=relative shows dates relative to the current time, e.g. "2
113 hours ago".
114
115 --date=local shows timestamps in user´s local timezone.
116
117 --date=iso (or --date=iso8601) shows timestamps in ISO 8601 format.
118
119 --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format,
120 often found in E-mail messages.
121
122 --date=short shows only date but not time, in YYYY-MM-DD format.
123
124 --date=default shows timestamps in the original timezone (either
125 committer´s or author´s).
126
127 --header
128 Print the contents of the commit in raw-format; each record is
129 separated with a NUL character.
130
131 --parents
132 Print the parents of the commit.
133
134 --timestamp
135 Print the raw commit timestamp.
136
137 --left-right
138 Mark which side of a symmetric diff a commit is reachable from.
139 Commits from the left side are prefixed with < and those from the
140 right with >. If combined with --boundary, those commits are
141 prefixed with -.
142
143 For example, if you have this topology:
144
145
146
147 y---b---b branch B
148 / \ /
149 / .
150 / / \
151 o---x---a---a branch A
152
153 you would get an output line this:
154
155
156
157 $ git rev-list --left-right --boundary --pretty=oneline A...B
158
159 >bbbbbbb... 3rd on b
160 >bbbbbbb... 2nd on b
161 <aaaaaaa... 3rd on a
162 <aaaaaaa... 2nd on a
163 -yyyyyyy... 1st on b
164 -xxxxxxx... 1st on a
165
166
167 Diff Formatting
168 Below are listed options that control the formatting of diff output.
169 Some of them are specific to git-rev-list(1), however other diff
170 options may be given. See git-diff-files(1) for more options.
171
172 -c
173 This flag changes the way a merge commit is displayed. It shows the
174 differences from each of the parents to the merge result
175 simultaneously instead of showing pairwise diff between a parent
176 and the result one at a time. Furthermore, it lists only files
177 which were modified from all parents.
178
179 --cc
180 This flag implies the -c options and further compresses the patch
181 output by omitting hunks that show differences from only one
182 parent, or show the same change from all but one parent for an
183 Octopus merge.
184
185 -r
186 Show recursive diffs.
187
188 -t
189 Show the tree objects in the diff output. This implies -r.
190
191 Commit Limiting
192 Besides specifying a range of commits that should be listed using the
193 special notations explained in the description, additional commit
194 limiting may be applied.
195
196 -n number, --max-count=number
197 Limit the number of commits output.
198
199 --skip=number
200 Skip number commits before starting to show the commit output.
201
202 --since=date, --after=date
203 Show commits more recent than a specific date.
204
205 --until=date, --before=date
206 Show commits older than a specific date.
207
208 --max-age=timestamp, --min-age=timestamp
209 Limit the commits output to specified time range.
210
211 --author=pattern, --committer=pattern
212 Limit the commits output to ones with author/committer header lines
213 that match the specified pattern (regular expression).
214
215 --grep=pattern
216 Limit the commits output to ones with log message that matches the
217 specified pattern (regular expression).
218
219 -i, --regexp-ignore-case
220 Match the regexp limiting patterns without regard to letters case.
221
222 -E, --extended-regexp
223 Consider the limiting patterns to be extended regular expressions
224 instead of the default basic regular expressions.
225
226 --remove-empty
227 Stop when a given path disappears from the tree.
228
229 --full-history
230 Show also parts of history irrelevant to current state of a given
231 path. This turns off history simplification, which removed merges
232 which didn´t change anything at all at some child. It will still
233 actually simplify away merges that didn´t change anything at all
234 into either child.
235
236 --no-merges
237 Do not print commits with more than one parent.
238
239 --not
240 Reverses the meaning of the ^ prefix (or lack thereof) for all
241 following revision specifiers, up to the next --not.
242
243 --all
244 Pretend as if all the refs in $GIT_DIR/refs/ are listed on the
245 command line as <commit>.
246
247 --stdin
248 In addition to the <commit> listed on the command line, read them
249 from the standard input.
250
251 --cherry-pick
252 Omit any commit that introduces the same change as another commit
253 on the "other side" when the set of commits are limited with
254 symmetric difference. For example, if you have two branches, A and
255 B, a usual way to list all commits on only one side of them is with
256 --left-right, like the example above in the description of that
257 option. It however shows the commits that were cherry-picked from
258 the other branch (for example, "3rd on b" may be cherry-picked from
259 branch A). With this option, such pairs of commits are excluded
260 from the output.
261
262 -g, --walk-reflogs
263 Instead of walking the commit ancestry chain, walk reflog entries
264 from the most recent one to older ones. When this option is used
265 you cannot specify commits to exclude (that is, ^commit,
266 commit1..commit2, nor commit1...commit2 notations cannot be used).
267 With --pretty format other than oneline (for obvious reasons), this
268 causes the output to have two extra lines of information taken from
269 the reflog. By default, commit@{Nth} notation is used in the
270 output. When the starting commit is specified as instead. Under
271 --pretty=oneline, the commit message is prefixed with this
272 information on the same line.
273
274 Cannot be combined with --reverse.
275
276 --merge
277 After a failed merge, show refs that touch files having a conflict
278 and don´t exist on all heads to merge.
279
280 --boundary
281 Output uninteresting commits at the boundary, which are usually not
282 shown.
283
284 --dense, --sparse
285 When optional paths are given, the default behaviour (--dense) is
286 to only output commits that changes at least one of them, and also
287 ignore merges that do not touch the given paths.
288
289 Use the --sparse flag to makes the command output all eligible
290 commits (still subject to count and age limitation), but apply
291 merge simplification nevertheless.
292
293 --bisect
294 Limit output to the one commit object which is roughly halfway
295 between the included and excluded commits. Thus, if
296
297
298
299 $ git-rev-list --bisect foo ^bar ^baz
300
301 outputs midpoint, the output of the two commands
302
303
304
305 $ git-rev-list foo ^midpoint
306 $ git-rev-list midpoint ^bar ^baz
307
308 would be of roughly the same length. Finding the change which
309 introduces a regression is thus reduced to a binary search:
310 repeatedly generate and test new ´midpoint´s until the commit chain
311 is of length one.
312
313 --bisect-vars
314 This calculates the same as --bisect, but outputs text ready to be
315 eval´ed by the shell. These lines will assign the name of the
316 midpoint revision to the variable bisect_rev, and the expected
317 number of commits to be tested after bisect_rev is tested to
318 bisect_nr, the expected number of commits to be tested if
319 bisect_rev turns out to be good to bisect_good, the expected number
320 of commits to be tested if bisect_rev turns out to be bad to
321 bisect_bad, and the number of commits we are bisecting right now to
322 bisect_all.
323
324 Commit Ordering
325 By default, the commits are shown in reverse chronological order.
326
327 --topo-order
328 This option makes them appear in topological order (i.e. descendant
329 commits are shown before their parents).
330
331 --date-order
332 This option is similar to --topo-order in the sense that no parent
333 comes before all of its children, but otherwise things are still
334 ordered in the commit timestamp order.
335
336 --reverse
337 Output the commits in reverse order. Cannot be combined with
338 --walk-reflogs.
339
340 Object Traversal
341 These options are mostly targeted for packing of git repositories.
342
343 --objects
344 Print the object IDs of any object referenced by the listed
345 commits. git-rev-list --objects foo ^bar thus means "send me all
346 object IDs which I need to download if I have the commit object
347 bar, but not foo".
348
349 --objects-edge
350 Similar to --objects, but also print the IDs of excluded commits
351 prefixed with a "-" character. This is used by git-pack-objects(1)
352 to build "thin" pack, which records objects in deltified form based
353 on objects contained in these excluded commits to reduce network
354 traffic.
355
356 --unpacked
357 Only useful with --objects; print the object IDs that are not in
358 packs.
359
360 --no-walk
361 Only show the given revs, but do not traverse their ancestors.
362
363 --do-walk
364 Overrides a previous --no-walk.
365
367 If the commit is a merge, and if the pretty-format is not oneline,
368 email or raw, an additional line is inserted before the Author: line.
369 This line begins with "Merge: " and the sha1s of ancestral commits are
370 printed, separated by spaces. Note that the listed commits may not
371 necessarily be the list of the direct parent commits if you have
372 limited your view of history: for example, if you are only interested
373 in changes related to a certain directory or file.
374
375 Here are some additional details for each format:
376
377
378 · oneline
379
380
381 <sha1> <title line>
382 This is designed to be as compact as possible.
383
384 · short
385
386
387 commit <sha1>
388 Author: <author>
389
390 <title line>
391
392 · medium
393
394
395 commit <sha1>
396 Author: <author>
397 Date: <date>
398
399 <title line>
400
401 <full commit message>
402
403 · full
404
405
406 commit <sha1>
407 Author: <author>
408 Commit: <committer>
409
410 <title line>
411
412 <full commit message>
413
414 · fuller
415
416
417 commit <sha1>
418 Author: <author>
419 AuthorDate: <date & time>
420 Commit: <committer>
421 CommitDate: <date & time>
422
423 <title line>
424
425 <full commit message>
426
427 · email
428
429
430 From <sha1> <date>
431 From: <author>
432 Date: <date & time>
433 Subject: [PATCH] <title line>
434
435 <full commit message>
436
437 · raw
438
439 The raw format shows the entire commit exactly as stored in the
440 commit object. Notably, the SHA1s are displayed in full, regardless
441 of whether --abbrev or --no-abbrev are used, and parents
442 information show the true parent commits, without taking grafts nor
443 history simplification into account.
444
445 · format:
446
447 The format: format allows you to specify which information you want
448 to show. It works a little bit like printf format, with the notable
449 exception that you get a newline with %n instead of \n.
450
451 E.g, format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"
452 would show something like this:
453
454
455
456 The author of fe6e0ee was Junio C Hamano, 23 hours ago
457 The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
458
459
460 The placeholders are:
461
462
463 · %H: commit hash
464
465 · %h: abbreviated commit hash
466
467 · %T: tree hash
468
469 · %t: abbreviated tree hash
470
471 · %P: parent hashes
472
473 · %p: abbreviated parent hashes
474
475 · %an: author name
476
477 · %ae: author email
478
479 · %ad: author date
480
481 · %aD: author date, RFC2822 style
482
483 · %ar: author date, relative
484
485 · %at: author date, UNIX timestamp
486
487 · %ai: author date, ISO 8601 format
488
489 · %cn: committer name
490
491 · %ce: committer email
492
493 · %cd: committer date
494
495 · %cD: committer date, RFC2822 style
496
497 · %cr: committer date, relative
498
499 · %ct: committer date, UNIX timestamp
500
501 · %ci: committer date, ISO 8601 format
502
503 · %e: encoding
504
505 · %s: subject
506
507 · %b: body
508
509 · %Cred: switch color to red
510
511 · %Cgreen: switch color to green
512
513 · %Cblue: switch color to blue
514
515 · %Creset: reset color
516
517 · %m: left, right or boundary mark
518
519 · %n: newline
520
522 Written by Linus Torvalds <torvalds@osdl.org>
523
525 Documentation by David Greaves, Junio C Hamano, Jonas Fonseca and the
526 git-list <git@vger.kernel.org>.
527
529 Part of the git(7) suite
530
531
532
533
534Git 1.5.3.3 10/09/2007 GIT-REV-LIST(1)