One way hg to git sync

Viewed 1503

I have a mercurial repository which contains a monolith project I am trying to gradually split. While doing those, I figured I would convert the new sub projects to git hence the one way sync.

A few more details about what I am doing:

  • the hg repo and the new git repos are located in a private bitbucket cloud account.
  • I want to keep the commits history while doing the split
  • All our development is Windows based (although I'm open to do the migration using a unix based system)
  • the initial repo is 7 years old, it has all sort of tags, closed branches, some branches with unsupported git characters. But more importantly I am happy if I can migrate only the default/master (if it helps me get the job done and doesn't imply losing history)
  • As we are gradually converting some projects inside the repo (lets say I have 30 projects and I want incrementally to move them) I need to do one way syncs from hg to git. I am not afraid of the merges and I am happy to keep my new repo work outside of master and then just rebase with the hg changes as we go.
  • I get the idea our mercurial repo is not properly configured (I saw multiple heads, etc) but I am outside my comfort zone when I dig deep into into mercurial backbone.

So far I tried several tools such as fast-export, mercurial hg hggit plugin. However I am struggling to find good step by step tools. (and almost all approaches in this thread Convert Mercurial project to Git)

fast-export was the tool that gave me the best results, I was able to migrate the project once and everything but when I tried to resync I started to get errors, like branch modified outside and multiple heads.

Now that I explained my problem in more detail I can ask the question.

What would be the best approach and tools to use for me to be able to do a one way hg to git migration?

Also, how can I make sure my mercurial repository is correctly configured to avoid any potential issues when migrating to git?

1 Answers
Related