问题
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
.
回答1:
I don't think this is possible.
You can at most do a shallow clone, only getting the history X commits back, but for them the objects will still be downloaded.
The only thing that could help you is the --single-branch
option which only downloads the history for one single branch instead of all branches.
来源:https://stackoverflow.com/questions/36547904/git-clone-without-objects-to-do-git-log