Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-rev-list(1) |
| 2 | =============== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-rev-list - Lists commit objects in reverse chronological order |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 6c6b0e5 | 2019-10-11 07:28:25 | [diff] [blame] | 12 | 'git rev-list' [<options>] <commit>... [[--] <path>...] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 16 | |
Junio C Hamano | 31cca16 | 2009-08-07 05:40:01 | [diff] [blame] | 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. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 21 | |
Junio C Hamano | 31cca16 | 2009-08-07 05:40:01 | [diff] [blame] | 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: |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 30 | |
| 31 | ----------------------------------------------------------------------- |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 32 | $ git rev-list foo bar ^baz |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 33 | ----------------------------------------------------------------------- |
| 34 | |
Junio C Hamano | 31cca16 | 2009-08-07 05:40:01 | [diff] [blame] | 35 | means "list all the commits which are reachable from 'foo' or 'bar', but |
| 36 | not from 'baz'". |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 37 | |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 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: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 41 | |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 42 | ----------------------------------------------------------------------- |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 43 | $ git rev-list origin..HEAD |
| 44 | $ git rev-list HEAD ^origin |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 45 | ----------------------------------------------------------------------- |
| 46 | |
| 47 | Another special notation is "'<commit1>'...'<commit2>'" which is useful |
| 48 | for merges. The resulting set of commits is the symmetric difference |
Junio C Hamano | 872c568 | 2006-07-07 06:05:40 | [diff] [blame] | 49 | between the two operands. The following two commands are equivalent: |
| 50 | |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 51 | ----------------------------------------------------------------------- |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 52 | $ git rev-list A B --not $(git merge-base --all A B) |
| 53 | $ git rev-list A...B |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 54 | ----------------------------------------------------------------------- |
| 55 | |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 56 | 'rev-list' is a very essential Git command, since it |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 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 |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 59 | used by commands as different as 'git bisect' and |
| 60 | 'git repack'. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 61 | |
| 62 | OPTIONS |
| 63 | ------- |
Junio C Hamano | 89e135d | 2006-09-03 06:18:25 | [diff] [blame] | 64 | |
Junio C Hamano | b0e0295 | 2008-01-19 08:02:00 | [diff] [blame] | 65 | :git-rev-list: 1 |
| 66 | include::rev-list-options.txt[] |
Junio C Hamano | 0430e3a | 2007-05-15 03:13:17 | [diff] [blame] | 67 | |
| 68 | include::pretty-formats.txt[] |
| 69 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 70 | GIT |
| 71 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 72 | Part of the linkgit:git[1] suite |