Is there a way to git fetch and only get the history - no files

纵饮孤独 提交于 2020-01-23 03:28:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!