I am trying to figure out if there is a way to get the count of the number of commits done on a specific branch.
I have tried using rev-list
, but the count I am getting is different.
PS C:\Dev\code\TestProj> git checkout master
Already on 'master'
Your branch is up to date with 'origin/master'.
PS C:\Dev\code\TestProj> git checkout -B "TESTBRANCH"
Switched to a new branch 'TESTBRANCH'
PS C:\Dev\code\TestProj> git commit -a -m "TESTBRANCH-TEST COMMIT"
[TESTBRANCH 3a98967] TESTBRANCH-TEST COMMIT
1 file changed, 1 insertion(+)
PS C:\Dev\code\TestProj> git rev-list --count --first-parent TESTBRANCH
9
PS C:\Dev\code\TestProj>
In the above code, I have made only one commit on the new branch which I created and I can see the count returned is 9. I think Git is taking into consideration some other revisions as well.
Is there a way to get the commit count as just 1?