Maintaining Git Fork of Hg Repository with Patches

心已入冬 提交于 2019-12-12 04:36:36

问题


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?


回答1:


  • 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



来源:https://stackoverflow.com/questions/26640345/maintaining-git-fork-of-hg-repository-with-patches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!