![](/img/trans.png)
[英]Is there a way to use a Mercurial repository as Git submodule? (update)
[英]Is there a way to use a Mercurial repository as Git submodule?
我一直很高兴地使用子模块来跟踪项目所依赖的所有库。 问题是我正在使用一个名为core-plot的库,它只有一个公共的Mercury存储库。 我可能可以将其镜像到只读的Git存储库中,但这是我得到的最佳选择吗? 我已经看到Mercurial中有一些模块可以跟踪Git中的内容。 有人知道是否存在其他方法吗?
使用git-hg 。
首先,请确保您的主存储库下有一个(非Mercurial)git子模块。 如果您还没有其他子模块,只需为core-plot
以外的某些库创建一个虚拟子模块,例如:
main-repo $ git submodule add https://repo.url.com/repo.git repo
其次,将core-plot
到某个目录中。
main-repo $ git-hg clone https://code.google.com/p/core-plot/ core-plot
将新的仓库添加到子模块列表中。
main-repo $ git submodule add ./core-plot core-plot
main-repo $ git commit -am "added core-plot submodule"
从现在开始,此存储库中的任何克隆都将提取两个存储库。 (在子模块初始化和更新之后)。
我到目前为止发现的一些问题是:
git-hg
必须git-hg pull
。 Hg repo的相反问题git子模块? 在StackOverflow上也被询问。 最好的答案是项目hg-git和git-hg。 另一个相关的相反问题是, 如何处理已转换为Mercurial的存储库上的Git子模块 。
以我的经验,大多数活跃的非git项目都有一个最新的git镜像在GitHub上浮动。 看起来core-plot
也有一个:
https://github.com/djw/core-plot
如果您愿意依靠谁来建立该镜像,那么将子模块安装到位似乎是最简单的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.