To find the number of commits on a git branch you can do:
$ git rev-list --count HEAD
920
However, if you initially clone with --depth=1
, that doesn't work:
$ git clone https://github.com/ndmitchell/hoogle.git --depth=1
$ cd hoogle
$ git rev-list --count HEAD
1
Is there any way to get the speed and reduced network traffic of a --depth=1
clone, but then also get the count of the number of commits?