Git fork
at reftables-rust 61 lines 2.5 kB view raw
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 15ifdef::git-rev-list[] 16----------------------------------------------------------------------- 17$ git rev-list foo bar ^baz 18----------------------------------------------------------------------- 19endif::git-rev-list[] 20ifdef::git-log[] 21----------------------------------------------------------------------- 22$ git log foo bar ^baz 23----------------------------------------------------------------------- 24endif::git-log[] 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 33ifdef::git-rev-list[] 34----------------------------------------------------------------------- 35$ git rev-list origin..HEAD 36$ git rev-list HEAD ^origin 37----------------------------------------------------------------------- 38endif::git-rev-list[] 39ifdef::git-log[] 40----------------------------------------------------------------------- 41$ git log origin..HEAD 42$ git log HEAD ^origin 43----------------------------------------------------------------------- 44endif::git-log[] 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 50ifdef::git-rev-list[] 51----------------------------------------------------------------------- 52$ git rev-list A B --not $(git merge-base --all A B) 53$ git rev-list A...B 54----------------------------------------------------------------------- 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[]