If you're just using one branch, such as master, I think this would work great:
git rev-list --full-history --all | wc -l
This will only output a number. You can alias it to something like
git revno
to make things really convenient. To do so, edit your .git/config
file and add this in:
[alias]
revno = "!git rev-list --full-history --all | wc -l"
This will not work on Windows. I do not know the equivalent of "wc" for that OS, but writing a Python script to do the counting for you would be a multi-platform solution.
EDIT: Get count between two commits:
I was looking for an answer that would show how to get the number of commits between two arbitrary revisions and didn't see any.
git rev-list --count [older-commit]..[newer-commit]