Alex Rothberg
Alex Rothberg

Reputation: 10983

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?

Upvotes: 0

Views: 93

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97280

  • 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

Upvotes: 1

Related Questions