问题
I'm creating a service that analyzes git repository logs, so I'd like to be able to clone down a repository's history without the files to save space. Is that possible?
回答1:
As you found out you have to use the following command:
git clone -n
-n / --no-checkout
No checkout of HEAD is performed after the clone is complete.
回答2:
The command
git clone -n
works perfectly. Thanks @JB Nizet!
回答3:
It is not possible with git protocol, but for github, it's doable with API:
https://api.github.com/repos/git/git/commits?per_page=100 https://api.github.com/repos/git/git/commits?per_page=100&page=2
and so on.
来源:https://stackoverflow.com/questions/34967989/is-there-a-way-to-git-fetch-and-only-get-the-history-no-files