nickcoxdotme nickcoxdotme - 10 days ago 7
Git Question

How can I count number of commits between two branches?

Using the

git diff --shortstat my_branch master
is a great way to tell how many files changes and the insertions and deletions. I read the git diff documentation, but I couldn't find a way to tell the number of commits between
my_branch
and
master
. Does that exist?

Answer

I think you could try:

git log --oneline mybranch ^master

For the exact count:

git log --oneline mybranch ^master | wc -l

Should give you the information you want.