revision

How do I get the Git commit count?

时间秒杀一切 提交于 2019-11-25 20:02:39
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... Benjamin Atkin To get a commit count for a revision ( HEAD , master , a commit hash): git rev-list --count <revision> To get the commit count across all