Craig P. Motlin
Craig P. Motlin

Reputation: 26740

Git: how to get a list of all revisions since some commit?

Using rev-list, I've figured out how to get a list of all revisions on one branch since some commit. How can I get a list of all revisions on all branches since some commit? Let's say the top of my repository looks like the following. How can I get a list of all commits since bbbbbbb (commits 3, 4, 5, and 6)? I don't care about the order.

* fffffff 6
* ddddddd 4
| * eeeeeee 5
| * ccccccc 3
|/  
* bbbbbbb 2
* aaaaaaa 1

cdhowie's answer is nearly what I need, but it also returns commits from unrelated branches. If I expand the tree to this shape, I don't want to see commit 7 listed.

* 0000000 7
| * fffffff 6
| * ddddddd 4
| | * eeeeeee 5
| | * ccccccc 3
| |/  
| * bbbbbbb 2
|/  
* aaaaaaa 1

Upvotes: 2

Views: 8631

Answers (2)

cdhowie
cdhowie

Reputation: 168988

git rev-list ^bbbbbbb branches...

For example, on this test repository:

chris@zack:~/git-test$ git log --all --graph --oneline
* 8daff2c f      <-- test
* 5f57b15 d
| * 764a725 e    <-- master
| * 5889800 c
|/
* 294908b b
* 975d652 a

chris@zack:~/git-test$ git rev-list ^294908b master test
8daff2c59d8cb966bf399de5027fae85ee016081
5f57b1524afeafbf37984f84fa5fe24ee0ac8501
764a7256d40dbefdb6278443fb80266f00358a37
58898005214607e5c53b45954a98891ea599c037

Upvotes: 7

Dustin
Dustin

Reputation: 90970

You can use git rev-list or git log (depending on what you're looking for), but the range is the important part.

git log bbbbbbb..fffffff in your case will give you everything from bbbbbbb to ffffffff but not including bbbbbbb. If you want to include bbbbbbb, just stick a ^ in front of it.

You don't want all changes since that, you want the ones leading to a particular change. In my repos (where I rebase a lot), there's a very large list of endpoints that exist that all fall off on their own.

Upvotes: 1

Related Questions