SO: How to get the git commit count?
Update: If all you need is a commit count, and you're running a newer version of git, you can use the following command:
git rev-list HEAD --count
Thanks ctrueden for pointing this out.
Original answer:
Adding to Rayne's answer, to strip out the blank lines and usernames from the output, and get just the commit count, run it through grep:
git shortlog | grep -E '^[ ]+\w+' | wc -l
The lines that have commit messages begin with some spaces.