How to get the git commit count?

Posted by Splo on Stack Overflow See other posts from Stack Overflow or by Splo
Published on 2009-03-24T13:38:55Z Indexed on 2010/04/23 17:33 UTC
Read the original article Hit count: 286

Filed under:
|
|

I'd like to get the number of commits of my git repository, a bit like SVN revision numbers. The goal is to use it as a unique, incrementing build number.

I currently do like that, on Unix/Cygwin/msysGit:

git log --pretty=format:'' | wc -l

But I feel it's a bit of a hack.

Is there a better way to do that? It would be cool if I actually didn't need wc or even git, so it could work on a bare Windows. Just read a file or a directory structure ...

© Stack Overflow or respective owner

Related posts about git

Related posts about revision