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