DEV Community

Cover image for Counting commits with Git
Adam K Dean
Adam K Dean

Posted on

Counting commits with Git

To count commits on a branch, you can use git rev-list.

For the branch you're on, use:

git rev-list --count HEAD
5
Enter fullscreen mode Exit fullscreen mode

Or for another <branch>, use:

git rev-list --count <branch>
5
Enter fullscreen mode Exit fullscreen mode

Also, to count commits by author, you can use git shortlog:

git shortlog -s -n
4 Some User
1 Joe Bloggs
Enter fullscreen mode Exit fullscreen mode

Top comments (0)