]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/rev-list-description.txt
Merge branch 'cm/t7xxx-cleanup'
[thirdparty/git.git] / Documentation / rev-list-description.txt
CommitLineData
6be6b171
PB
1List commits that are reachable by following the `parent` links from the
2given commit(s), but exclude commits that are reachable from the one(s)
3given with a '{caret}' in front of them. The output is given in reverse
4chronological order by default.
5
6You can think of this as a set operation. Commits reachable from any of
7the commits given on the command line form a set, and then commits reachable
8from any of the ones given with '{caret}' in front are subtracted from that
9set. The remaining commits are what comes out in the command's output.
10Various other options and paths parameters can be used to further limit the
11result.
12
13Thus, the following command:
14
bea86658 15ifdef::git-rev-list[]
6be6b171
PB
16-----------------------------------------------------------------------
17$ git rev-list foo bar ^baz
18-----------------------------------------------------------------------
bea86658
PB
19endif::git-rev-list[]
20ifdef::git-log[]
21-----------------------------------------------------------------------
22$ git log foo bar ^baz
23-----------------------------------------------------------------------
24endif::git-log[]
6be6b171
PB
25
26means "list all the commits which are reachable from 'foo' or 'bar', but
27not from 'baz'".
28
29A special notation "'<commit1>'..'<commit2>'" can be used as a
30short-hand for "^'<commit1>' '<commit2>'". For example, either of
31the following may be used interchangeably:
32
bea86658 33ifdef::git-rev-list[]
6be6b171
PB
34-----------------------------------------------------------------------
35$ git rev-list origin..HEAD
36$ git rev-list HEAD ^origin
37-----------------------------------------------------------------------
bea86658
PB
38endif::git-rev-list[]
39ifdef::git-log[]
40-----------------------------------------------------------------------
41$ git log origin..HEAD
42$ git log HEAD ^origin
43-----------------------------------------------------------------------
44endif::git-log[]
6be6b171
PB
45
46Another special notation is "'<commit1>'...'<commit2>'" which is useful
47for merges. The resulting set of commits is the symmetric difference
48between the two operands. The following two commands are equivalent:
49
bea86658 50ifdef::git-rev-list[]
6be6b171
PB
51-----------------------------------------------------------------------
52$ git rev-list A B --not $(git merge-base --all A B)
53$ git rev-list A...B
54-----------------------------------------------------------------------
bea86658
PB
55endif::git-rev-list[]
56ifdef::git-log[]
57-----------------------------------------------------------------------
58$ git log A B --not $(git merge-base --all A B)
59$ git log A...B
60-----------------------------------------------------------------------
61endif::git-log[]