The keywords here are "shallow clone".
Checking out a given revision can be rather long in itself, but this is not the longest operation while cloning a repository, since all objects will be repatriated first before a given revision is checked out.
You may want, however, to take a look at the --depth
and --shallow-since
parameters of git clone
, which will allow you to fetch only the tips of the branches until a given point.
This will let you quickly retrieve the most recent history of a given repository, which is probably what you need the most, then use git fetch
again to repatriate the rest of a branch if needed.
Retrieving the sole history in itself is unfortunately not possible (as far as I know) since this history is not "recorded" as a whole in some kind of file but constituted by the recursive references of each object to its fathers one.
So, something really dirty you could do if you had an access (even read-only) to the .git
original subdirectory is to copy all files located under .git/objects
but only the ones which are known to be commit
(you can tell it with git cat-file -t
). The thing would be broken in itself because neither the trees nor the files themselves would be available at the time you do, but you would still be able to fetch them with a git remote update
or similar operation.