Search code examples
gitcommit

How to retrieve the number of commits of a Git branch without downloading full commit history


I need to obtain the commit count from a Git repository. How can I do this with a git command without downloading the entire commit history?


Solution

  • git clone --bare --filter=tree:0   u://r/l
    

    The main hosting services support filtering, if wherever's hosting your repo doesn't you'll need help from the administrators.