git clone --depth N ...
creates a shallow clone with history limited to the last N revisions and I can use git clone -b tag ...
to fetch the commits re
If running at least Git 2.11 on both client and server side, there's a work-around if you know the date of the tagged commit and which branch it is on:
git clone --branch <branch that contains tag> --shallow-since=<date of tagged commit> <url>
Indeed, there is no direct way, and this kind of counting or multiple-ref-based cloning would have to be implemented on the server side (the server delivering the initial shallow clone) for it to work within git's constraints.
There's an indirect way though: start with a depth 1 shallow clone, then deepen repeatedly until the tag appears. Annoyingly, git fetch --depth=<N>
won't pick up new tags (but you can use git ls-remote
or similar to get everything once on the shallow-clone client, and watch for the SHA-1). But I suspect this method would be so slow as to make it pretty worthless.