简体   繁体   English

用补丁维护Hg存储库的Git Fork

[英]Maintaining Git Fork of Hg Repository with Patches

I am maintaining a git fork of an hg repository with some additional patches. 我正在维护带有一些其他补丁的hg存储库的git fork。 What this means is that I have cloned the hg repository and then pushed that repository to a git repository following these directions . 这意味着,我已经克隆了汞库,然后推该库以下面一个Git仓库这些方向

I then cloned the git repository, applied some commits and then pushed those commits to the git repository. 然后,我克隆了git存储库,应用了一些提交,然后将这些提交推送到git存储库。

My history look like: 我的历史记录如下:

hg-head\      /git-head
    A-B-C-F'-G'

where F' and G' are my patches. F'G'是我的补丁。

The hg developer now pushes some patches to the hg repos and I want to incorporate those changes into my fork. hg开发人员现在将一些补丁推送到hg仓库,我想将这些更改合并到我的fork中。 I would like to do so keeping the hg history intact. 我想这样做,以保持汞史完整。 In other words, I want my final history in git to look like: 换句话说,我希望我在git中的最终历史看起来像:

hg-head\        /git-head
    A-B-C-E-F'-G'

where E is the new commit on hg. 其中E是对hg的新提交。

in git terminology this would be saying "I want to rebase my master branch onto origin/master". 在git的术语来说,这个会说“我要rebase我的主分支到原点/主”。

My question is what commands do I execute in hg and/or git to make this happen? 我的问题是我应该在hg和/或git中执行哪些命令来实现此目的?

  • If you didn't pull (your patches) from Git to local HG-repo, you can do nothing at HG-side 如果您没有将(补丁)从Git拉到本地HG-repo,您​​在HG端将无能为力
  • If you pulled from Git, you'll get additional head ("anonymous branches") in local repository after pulling E from upstream repository. 如果从Git中拉出,则从上游存储库中拉出E后,您将在本地存储库中获得其他头(“匿名分支”)。 In order to linearize history (if you want it, while it isn't needed at "mediator"), you'll use the same (by name) command in Mercurial: hg rebase 为了线性化历史记录(如果需要,而“调解员”不需要它),您将在Mercurial中使用相同的(按名称)命令: hg rebase

Just note : You can simplify your workflow, if, instead of intermediate HG-node, you'll try to use Mercurial bridge in Git (part of Git now) for direct accessing upstream Mercurial repo from your Git 只需注意 :您可以简化工作流程,如果您尝试使用Git中的Mercurial桥 (现在是Git的一部分)代替中间的HG节点,以便从Git直接访问上游Mercurial存储库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM