git shallow clone since specific commit

不想你离开。 提交于 2020-04-11 04:29:26

问题


I'd like to clone a repository with a longish history. I'm only interested in a few short-lived not-yet-merged feature branches and master.

In order to not confuse myself with all that past history and merged branches, I'd like to do a shallow clone starting at a specific commit SHA.

However, so far I've only found documentation on how to do shallow clones that only include the last n commits (--depth) resp, the commits since a specific date (--shallow-since).

Is there a way to specify a shallow-clone starting at a given commit?


回答1:


There is not, which is kind of a shame since it would be easy for Git to implement.

Usually using --depth is sufficient: just start with a depth you think is enough, and if it's not, repeatedly fetch with --deepen or --depth as needed.




回答2:


What about creating a branch at that special commit and then git clone --single-branch?



来源:https://stackoverflow.com/questions/52140523/git-shallow-clone-since-specific-commit

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