删除 git 子模块存储库中的分支是否会使该分支中的提交对超级项目不可用?
我对 git 相当陌生,我怀疑这个问题的答案是否定的,但想在这里咨询一些更有经验的 git 用户。
我有一个超级项目,其中包含对子模块的开发分支的引用。我有点担心,当我将该开发分支重新设置为 master 并删除它时,引用的子模块提交将会消失,从而使引用它的超级项目提交无法使用。
虽然我已经回答了这个问题,但它又提出了另一个问题。这种行为可以依靠吗?我读过 git 将已删除的项目保留在 refs 中一段时间,然后将其删除。这是否会导致克隆首先工作,然后又失败?
I'm fairly new to git, and I suspect the answer to this is no, but wanted to check with some of the more experienced git users here.
I have a superproject which has a commit which includes a reference to a development branch of a submodule. I'm a little worried that when I rebase that development branch onto master and delete it that the referenced submodule commit will disappear, making the superproject commit that references it unusable.
Though I've answered the question, it has brought up another question. Can this behavior be counted on? I've read that git keeps deleted items around in refs for a period of time, then removes them. Could this result in the clone working at first, then failing later?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于没有得到任何答案,我决定尝试一下。我创建了一个带有子模块的项目,并在子项目中使用三种不同的配置提交了对超级项目的更改:
提交已重新基于 master
没有任何变化和分支
已删除。
具有引用提交的分支
就被简单地删除了。
在所有这些情况下,使用“git clone --recursive”克隆超级项目成功添加了具有引用提交的子模块。
Since I didn't get any answers, I decided to try it out. I made a project with a submodule and committed changes to the superproject with three different configurations in the subproject:
commit was rebased onto master
without any changes and the branch
deleted.
branch with the referenced commit
was simply deleted.
In all of these cases cloning the superproject with 'git clone --recursive' successfully added the submodule with the referenced commit.