Code

Merge branch 'maint'
[git.git] / Documentation / git-rev-list.txt
1 git-rev-list(1)
2 ===============
4 NAME
5 ----
6 git-rev-list - Lists commit objects in reverse chronological order
9 SYNOPSIS
10 --------
11 [verse]
12 'git-rev-list' [ \--max-count=number ]
13              [ \--skip=number ]
14              [ \--max-age=timestamp ]
15              [ \--min-age=timestamp ]
16              [ \--sparse ]
17              [ \--no-merges ]
18              [ \--remove-empty ]
19              [ \--not ]
20              [ \--all ]
21              [ \--stdin ]
22              [ \--topo-order ]
23              [ \--parents ]
24              [ \--left-right ]
25              [ \--cherry-pick ]
26              [ \--encoding[=<encoding>] ]
27              [ \--(author|committer|grep)=<pattern> ]
28              [ [\--objects | \--objects-edge] [ \--unpacked ] ]
29              [ \--pretty | \--header ]
30              [ \--bisect ]
31              [ \--bisect-vars ]
32              [ \--merge ]
33              [ \--reverse ]
34              [ \--walk-reflogs ]
35              <commit>... [ \-- <paths>... ]
37 DESCRIPTION
38 -----------
40 Lists commit objects in reverse chronological order starting at the
41 given commit(s), taking ancestry relationship into account.  This is
42 useful to produce human-readable log output.
44 Commits which are stated with a preceding '{caret}' cause listing to
45 stop at that point. Their parents are implied. Thus the following
46 command:
48 -----------------------------------------------------------------------
49         $ git-rev-list foo bar ^baz
50 -----------------------------------------------------------------------
52 means "list all the commits which are included in 'foo' and 'bar', but
53 not in 'baz'".
55 A special notation "'<commit1>'..'<commit2>'" can be used as a
56 short-hand for "{caret}'<commit1>' '<commit2>'". For example, either of
57 the following may be used interchangeably:
59 -----------------------------------------------------------------------
60         $ git-rev-list origin..HEAD
61         $ git-rev-list HEAD ^origin
62 -----------------------------------------------------------------------
64 Another special notation is "'<commit1>'...'<commit2>'" which is useful
65 for merges.  The resulting set of commits is the symmetric difference
66 between the two operands.  The following two commands are equivalent:
68 -----------------------------------------------------------------------
69         $ git-rev-list A B --not $(git-merge-base --all A B)
70         $ git-rev-list A...B
71 -----------------------------------------------------------------------
73 gitlink:git-rev-list[1] is a very essential git program, since it
74 provides the ability to build and traverse commit ancestry graphs. For
75 this reason, it has a lot of different options that enables it to be
76 used by commands as different as gitlink:git-bisect[1] and
77 gitlink:git-repack[1].
79 OPTIONS
80 -------
82 Commit Formatting
83 ~~~~~~~~~~~~~~~~~
85 Using these options, gitlink:git-rev-list[1] will act similar to the
86 more specialized family of commit log tools: gitlink:git-log[1],
87 gitlink:git-show[1], and gitlink:git-whatchanged[1]
89 include::pretty-formats.txt[]
91 --relative-date::
93         Show dates relative to the current time, e.g. "2 hours ago".
94         Only takes effect for dates shown in human-readable format, such
95         as when using "--pretty".
97 --header::
99         Print the contents of the commit in raw-format; each record is
100         separated with a NUL character.
102 --parents::
104         Print the parents of the commit.
106 --left-right::
108         Mark which side of a symmetric diff a commit is reachable from.
109         Commits from the left side are prefixed with `<` and those from
110         the right with `>`.  If combined with `--boundary`, those
111         commits are prefixed with `-`.
113 For example, if you have this topology:
115 -----------------------------------------------------------------------
116              y---b---b  branch B
117             / \ /
118            /   .
119           /   / \
120          o---x---a---a  branch A
121 -----------------------------------------------------------------------
123 you would get an output line this:
125 -----------------------------------------------------------------------
126         $ git rev-list --left-right --boundary --pretty=oneline A...B
128         >bbbbbbb... 3rd on b
129         >bbbbbbb... 2nd on b
130         <aaaaaaa... 3rd on a
131         <aaaaaaa... 2nd on a
132         -yyyyyyy... 1st on b
133         -xxxxxxx... 1st on a
134 -----------------------------------------------------------------------
136 Diff Formatting
137 ~~~~~~~~~~~~~~~
139 Below are listed options that control the formatting of diff output.
140 Some of them are specific to gitlink:git-rev-list[1], however other diff
141 options may be given. See gitlink:git-diff-files[1] for more options.
143 -c::
145         This flag changes the way a merge commit is displayed.  It shows
146         the differences from each of the parents to the merge result
147         simultaneously instead of showing pairwise diff between a parent
148         and the result one at a time. Furthermore, it lists only files
149         which were modified from all parents.
151 --cc::
153         This flag implies the '-c' options and further compresses the
154         patch output by omitting hunks that show differences from only
155         one parent, or show the same change from all but one parent for
156         an Octopus merge.
158 -r::
160         Show recursive diffs.
162 -t::
164         Show the tree objects in the diff output. This implies '-r'.
166 Commit Limiting
167 ~~~~~~~~~~~~~~~
169 Besides specifying a range of commits that should be listed using the
170 special notations explained in the description, additional commit
171 limiting may be applied.
173 --
175 -n 'number', --max-count='number'::
177         Limit the number of commits output.
179 --skip='number'::
181         Skip 'number' commits before starting to show the commit output.
183 --since='date', --after='date'::
185         Show commits more recent than a specific date.
187 --until='date', --before='date'::
189         Show commits older than a specific date.
191 --max-age='timestamp', --min-age='timestamp'::
193         Limit the commits output to specified time range.
195 --author='pattern', --committer='pattern'::
197         Limit the commits output to ones with author/committer
198         header lines that match the specified pattern.
200 --grep='pattern'::
202         Limit the commits output to ones with log message that
203         matches the specified pattern.
205 --remove-empty::
207         Stop when a given path disappears from the tree.
209 --no-merges::
211         Do not print commits with more than one parent.
213 --not::
215         Reverses the meaning of the '{caret}' prefix (or lack thereof)
216         for all following revision specifiers, up to the next '--not'.
218 --all::
220         Pretend as if all the refs in `$GIT_DIR/refs/` are listed on the
221         command line as '<commit>'.
223 --stdin::
225         In addition to the '<commit>' listed on the command
226         line, read them from the standard input.
228 --cherry-pick::
230         Omit any commit that introduces the same change as
231         another commit on the "other side" when the set of
232         commits are limited with symmetric difference.
234 For example, if you have two branches, `A` and `B`, a usual way
235 to list all commits on only one side of them is with
236 `--left-right`, like the example above in the description of
237 that option.  It however shows the commits that were cherry-picked
238 from the other branch (for example, "3rd on b" may be cherry-picked
239 from branch A).  With this option, such pairs of commits are
240 excluded from the output.
242 -g, --walk-reflogs::
244         Instead of walking the commit ancestry chain, walk
245         reflog entries from the most recent one to older ones.
246         When this option is used you cannot specify commits to
247         exclude (that is, '{caret}commit', 'commit1..commit2',
248         nor 'commit1...commit2' notations cannot be used).
250 With '\--pretty' format other than oneline (for obvious reasons),
251 this causes the output to have two extra lines of information
252 taken from the reflog.  By default, 'commit@{Nth}' notation is
253 used in the output.  When the starting commit is specified as
254 'commit@{now}', output also uses 'commit@{timestamp}' notation
255 instead.  Under '\--pretty=oneline', the commit message is
256 prefixed with this information on the same line.
258 --merge::
260         After a failed merge, show refs that touch files having a
261         conflict and don't exist on all heads to merge.
263 --boundary::
265         Output uninteresting commits at the boundary, which are usually
266         not shown.
268 --dense, --sparse::
270 When optional paths are given, the default behaviour ('--dense') is to
271 only output commits that changes at least one of them, and also ignore
272 merges that do not touch the given paths.
274 Use the '--sparse' flag to makes the command output all eligible commits
275 (still subject to count and age limitation), but apply merge
276 simplification nevertheless.
278 --bisect::
280 Limit output to the one commit object which is roughly halfway between
281 the included and excluded commits. Thus, if
283 -----------------------------------------------------------------------
284         $ git-rev-list --bisect foo ^bar ^baz
285 -----------------------------------------------------------------------
287 outputs 'midpoint', the output of the two commands
289 -----------------------------------------------------------------------
290         $ git-rev-list foo ^midpoint
291         $ git-rev-list midpoint ^bar ^baz
292 -----------------------------------------------------------------------
294 would be of roughly the same length.  Finding the change which
295 introduces a regression is thus reduced to a binary search: repeatedly
296 generate and test new 'midpoint's until the commit chain is of length
297 one.
299 --bisect-vars::
301 This calculates the same as `--bisect`, but outputs text ready
302 to be eval'ed by the shell. These lines will assign the name of
303 the midpoint revision to the variable `bisect_rev`, and the
304 expected number of commits to be tested after `bisect_rev` is
305 tested to `bisect_nr`, the expected number of commits to be
306 tested if `bisect_rev` turns out to be good to `bisect_good`,
307 the expected number of commits to be tested if `bisect_rev`
308 turns out to be bad to `bisect_bad`, and the number of commits
309 we are bisecting right now to `bisect_all`.
311 --
313 Commit Ordering
314 ~~~~~~~~~~~~~~~
316 By default, the commits are shown in reverse chronological order.
318 --topo-order::
320         This option makes them appear in topological order (i.e.
321         descendant commits are shown before their parents).
323 --date-order::
325         This option is similar to '--topo-order' in the sense that no
326         parent comes before all of its children, but otherwise things
327         are still ordered in the commit timestamp order.
329 --reverse::
331         Output the commits in reverse order.
333 Object Traversal
334 ~~~~~~~~~~~~~~~~
336 These options are mostly targeted for packing of git repositories.
338 --objects::
340         Print the object IDs of any object referenced by the listed
341         commits.  'git-rev-list --objects foo ^bar' thus means "send me
342         all object IDs which I need to download if I have the commit
343         object 'bar', but not 'foo'".
345 --objects-edge::
347         Similar to '--objects', but also print the IDs of excluded
348         commits prefixed with a "-" character.  This is used by
349         gitlink:git-pack-objects[1] to build "thin" pack, which records
350         objects in deltified form based on objects contained in these
351         excluded commits to reduce network traffic.
353 --unpacked::
355         Only useful with '--objects'; print the object IDs that are not
356         in packs.
358 Author
359 ------
360 Written by Linus Torvalds <torvalds@osdl.org>
362 Documentation
363 --------------
364 Documentation by David Greaves, Junio C Hamano, Jonas Fonseca
365 and the git-list <git@vger.kernel.org>.
367 GIT
368 ---
369 Part of the gitlink:git[7] suite