如何“冻结” git 子模块
我正在使用一些我自己不托管的存储库,我想如果我在它们不可用时部署我的应用程序怎么办?这根本不可能发生。
有没有一种方法可以以某种方式“冻结”子模块,当我从存储库中提取子模块时,子模块已经初始化并更新了?
任何帮助表示赞赏。
I'm using a few repository which I do not host myself and I thinking what if I deploy my application while they are not available? This simply just can't happen.
Is there a way to "freeze" the submodule somehow that when I pull from my repository the submodules are already init and update?
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过克隆这些存储库来托管您自己的镜像,并将您的镜像用作子模块。
Host your own mirrors of those repositories by cloning them, and use your mirrors as the submodules.
如果您无意跟踪子模块存储库中的开发,为什么要设置它呢?当您想要独立于您自己的存储库来跟踪外部开发时,可以使用子模块。我只需检查您想要“冻结”它的任何提交,然后将其提交到您的主存储库。这可以使用 子树合并来完成策略,它更适合合并外部存储库,然后与组合存储库的整个历史一起工作。
话虽这么说,当您部署/发布时,我不会依赖外部存储库和您的前沿开发源,而是简单地滚动发布存档/tarball/可执行文件/无论您如何发布 - 因为您已经有了子模块源自己,它就不再是问题了,尽管在任何情况下子树合并策略也可以缓解这个问题。
If you have no intention of tracking the development in the submodule'd repository, why set it up? Submodules are for when you want to track the external development of a repository separately from your own. I would simply checkout whatever commit you want to "freeze" it at, and commit it to your main repository. This can be done using the subtree merge strategy, which is more geared towards incorporating an external repository and then working with the entire history of the combined repositories together.
That having been said, when you are deploying/releasing, I wouldn't rely on external repositories and your bleeding-edge development sources anyways and simply rolling a release archive/tarball/executable/however you release - and since you've already got the submodule source yourself, it becomes a non-issue, though this problem is also mitigated by the subtree merge strategy in any case.