git浅克隆自特定提交以来 [英] git shallow clone since specific commit
问题描述
我想克隆一个历史悠久的存储库.我只对一些短暂的尚未合并的功能分支和master
感兴趣.
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
.
为了不让自己与过去的所有历史和合并的分支混淆,我想从特定的提交SHA开始做一个浅表克隆.
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.
但是,到目前为止,我只找到了有关如何进行浅表克隆的文档,这些浅表克隆仅包含最后一个n
提交(--depth
)以及自特定日期(--shallow-since
)以来的提交.
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?
推荐答案
没有,这有点可惜,因为Git易于实现.
There is not, which is kind of a shame since it would be easy for Git to implement.
通常使用--depth
就足够了:仅从您认为足够的深度开始,如果不够,请根据需要反复使用--deepen
或--depth
进行获取.
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.
这篇关于git浅克隆自特定提交以来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!