用修补程序维护Hg库的Git叉 [英] Maintaining Git Fork of Hg Repository with Patches

查看:171
本文介绍了用修补程序维护Hg库的Git叉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在维护一个hg版本库的git fork和一些额外的补丁。这意味着我克隆了hg存储库,然后在这些方向

然后我克隆了git仓库,应用了一些提交,然后将这些提交推送到了git仓库。



我的历史看起来像:

  hg-head \ / git-head 
ABC-F'-G '

其中 F' G'是我的补丁。



hg开发者现在将一些补丁推送到hg repos,我想将这些更改合并到我的叉子。我想这样做保持hg历史不变。换句话说,我希望我在git中的最终历史记录如下所示:

  hg-head \ / git-head 
ABCE-F'-G'

其中 E 是hg上的新提交。



用git术语来说,这就是我想要 rebase 我的主分支到达origin / master。



我的问题是我在hg和/或git中执行哪些命令来实现这一点?

$ b $如果你没有将你的补丁从Git中提取到本地HG-repo,那么你可以在HG- side
  • 如果您从Git中提取数据,在将E从上游存储库中提取后,您会在本地存储库中获得额外的头(匿名分支)。为了对历史进行线性化(如果你需要它,而在介体处不需要它),你将在Mercurial中使用相同的(按名称)命令: hg rebase Mercurial桥梁(现在是Git的一部分),用于从您的Git直接访问上游Mercurial回购


    I am maintaining a git fork of an hg repository with some additional patches. What this means is that I have cloned the hg repository and then pushed that repository to a git repository following these directions.

    I then cloned the git repository, applied some commits and then pushed those commits to the git repository.

    My history look like:

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

    where F' and G' are my patches.

    The hg developer now pushes some patches to the hg repos and I want to incorporate those changes into my 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:

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

    where E is the new commit on hg.

    in git terminology this would be saying "I want to rebase my master branch onto origin/master".

    My question is what commands do I execute in hg and/or git to make this happen?

    解决方案

    • If you didn't pull (your patches) from Git to local HG-repo, you can do nothing at HG-side
    • If you pulled from Git, you'll get additional head ("anonymous branches") in local repository after pulling E from upstream repository. 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

    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

    这篇关于用修补程序维护Hg库的Git叉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆