]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-rev-list.txt
Merge branch 'bw/format-patch-o-create-leading-dirs'
[thirdparty/git.git] / Documentation / git-rev-list.txt
CommitLineData
2cf565c5
DG
1git-rev-list(1)
2===============
2cf565c5
DG
3
4NAME
5----
6git-rev-list - Lists commit objects in reverse chronological order
7
8
9SYNOPSIS
10--------
353ce815 11[verse]
11a3d3aa 12'git rev-list' [<options>] <commit>... [[--] <path>...]
2cf565c5
DG
13
14DESCRIPTION
15-----------
8c02eee2 16
1a3d834f
JH
17List commits that are reachable by following the `parent` links from the
18given commit(s), but exclude commits that are reachable from the one(s)
19given with a '{caret}' in front of them. The output is given in reverse
20chronological order by default.
2cf565c5 21
1a3d834f
JH
22You can think of this as a set operation. Commits given on the command
23line form a set of commits that are reachable from any of them, and then
24commits reachable from any of the ones given with '{caret}' in front are
25subtracted from that set. The remaining commits are what comes out in the
26command's output. Various other options and paths parameters can be used
27to further limit the result.
28
29Thus, the following command:
8c02eee2
JF
30
31-----------------------------------------------------------------------
b1889c36 32 $ git rev-list foo bar ^baz
8c02eee2
JF
33-----------------------------------------------------------------------
34
1a3d834f
JH
35means "list all the commits which are reachable from 'foo' or 'bar', but
36not from 'baz'".
adcd3512 37
8c02eee2
JF
38A special notation "'<commit1>'..'<commit2>'" can be used as a
39short-hand for "{caret}'<commit1>' '<commit2>'". For example, either of
40the following may be used interchangeably:
69e0c256 41
8c02eee2 42-----------------------------------------------------------------------
b1889c36
JN
43 $ git rev-list origin..HEAD
44 $ git rev-list HEAD ^origin
8c02eee2
JF
45-----------------------------------------------------------------------
46
47Another special notation is "'<commit1>'...'<commit2>'" which is useful
48for merges. The resulting set of commits is the symmetric difference
0d2c9d67
RS
49between the two operands. The following two commands are equivalent:
50
8c02eee2 51-----------------------------------------------------------------------
b1889c36
JN
52 $ git rev-list A B --not $(git merge-base --all A B)
53 $ git rev-list A...B
8c02eee2
JF
54-----------------------------------------------------------------------
55
2de9b711 56'rev-list' is a very essential Git command, since it
8c02eee2
JF
57provides the ability to build and traverse commit ancestry graphs. For
58this reason, it has a lot of different options that enables it to be
0b444cdb
TR
59used by commands as different as 'git bisect' and
60'git repack'.
69e0c256 61
df8baa42
JF
62OPTIONS
63-------
8c02eee2 64
fdcf39e5
MV
65:git-rev-list: 1
66include::rev-list-options.txt[]
331b51d2
JN
67
68include::pretty-formats.txt[]
69
2cf565c5
DG
70GIT
71---
9e1f0a85 72Part of the linkgit:git[1] suite