Reputation: 9442
So far I use the update
hook on the git server to check the message in commits.
When a new branch is added I get the arguments refs/heads/mybranch 00000...0000 <headShaOfBranch>
.
How can I check only the commits which are not yet in the repository? Whats the procedure to do this? (is it the wrong hook to do this?)
If I would take the range 0000
till <headShaOfBranch>
I would check every commit starting from <headShaOfBranch>
which is not good.
Upvotes: 1
Views: 128
Reputation: 9442
Use git rev-list
:
git rev-list "refs/heads/mybranch" --not --exclude "refs/heads/mybranch" --all
will output all commits starting from refs/heads/mybranch
which are not also reached by the set of all references --all
excluding refs/heads/mybranch
.
Note: The --exclude
is before -all
. See the docs!
Upvotes: 1