git rev-list --count HEAD

Category: Git - Core

git rev-list --count HEAD

Count the commits reachable from HEAD

Counts every commit reachable from the given ref, which is the total history length of the branch. Add a range like main..feature to count only commits unique to feature. CI scripts use it for versioning and change detection.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.