gitdownloadgit-clonerevision-history

git clone without objects to do git log


How can I clone a git repository without getting the actual files and all their revision deltas? I only want to be able to do git log | grep, no need to access files' contents.

I would like to skip this part of the cloning:

Receiving objects:  12% (359112/2981072), 432.66 MiB | 1.67 MiB/s

There are some repositories whose logs I want to grep, but without downloading/checking out the whole repository, because they weigh gigabytes. Even a solution where I only get a single branch's logs (e.g. master) interests me, if that helps.


Essentially I'm looking for something like svn log <repo url> for git.


Solution

  • Partial clone is now available in more recent versions of git:

    git clone --filter=blob:none --no-checkout git@github.com:foo/bar.git