Matías García Isaía

Matías García Isaía

Introducing: hg-to-git

2 min
Oct 9 2013
methodology
2 min
Oct 9 2013

Hi there!

Today I've managed to migrate one of our Mercurial repositories to git. The migration process was smoothly done by fast-export, but it left the new repository in a kind-of-messy status - a really dirty working copy, and closed branches were just the same as the [in]active ones.

We decided to map hg's closed branches to git tags, as they're similar - instead of re-opening a branch, you branch off a tag and you're done. So, after some bashing, here's the full script for migrating a Mercurial repository to a brand new git one:

You should download it, make it executable and run with the current hg repository as first parameter and the desired target name as the second one, like this:

That's it!

Happy indexing :)