0

I have a very large git history and building this on Jenkins takes quite a bit of time. There is a shallow clone option not to clone the entire tree, this makes the build much faster.

But since we use the commit counts as an identifier of the build numbers, I cannot use the shallow clone option.

I have looked at options here: How do I get the Git commit count?

git rev-list --count <revision>

but this seems to require you clone the entire repo,

Is there perhaps a git command to get the commit count "remotely" without cloning the entire repo?

Alex M
  • 2,472
  • 7
  • 25
  • 32
Wayne
  • 2,617
  • 2
  • 19
  • 38

1 Answers1

0

There is not a git command to do that, because there are not "remote" git commands. Git, by very nature, is a distributed system, meaning it operates on its own locally distributed copy of the data set.

You might be able to emulate what you want, by talking to a remote git installation, though, if you have shell access on the git server, via SSH:

ssh $githost git rev-list --count
Flimzy
  • 60,850
  • 13
  • 104
  • 147
  • ssh -c cipher_spec is for the cipher spec. I am wondering if Stash has some REST API to get the the count. – Wayne Oct 25 '16 at 14:02
  • I have a clone path, such as ssh://git@hostname:port/directory/project.git How can I use this url together with the ssh command? – Wayne Oct 25 '16 at 14:13