简体   繁体   中英

Maintaining Git Fork of Hg Repository with Patches

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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