![](/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.