Git-How to count commits since?

Just quick post here before start counting sheep. I was wondering if there was a way to count commit since a specific branch or tag. It turns out that there is a couple of way to do it. The easies since to be using rev-list. If we go to the official documentation rev-list it goes like this:

git-rev-list - Lists commit objects in reverse chronological order

That is kind of what we want, to do it we type in the terminal:

> git rev-list v0.5-beta

This will display the commit unti our tag v0.5-beta, but that is not exactly what we want because it count from commit 0 unti our tag. We actually want to from HEAD unti our tag. So let's try:

git rev-list v0.5-beta..HEAD 
git rev-list HEAD ^v0.5-beta

That will certainly display all the commits unique ids from HEAD to our tag. But how to count them? Well we use pipes, wc and a terminal and we end up with:

git rev-list v0.5-beta..HEAD | wc -l

Facebook icon Twitter icon LinkedIn icon e-mail icon