Rainbow Coding

Introducing How to convert hg repositories to git

Converting mercurial repository into git repository while preserving history is really easy task.

Git has gained lately lots of support, and it's not a bad idea to migrate all your source controls under same system. In the past I often used hg because it had some nice features and better Windows support, but this does not matter anymore these days.

So after looking for a solution for a while, I found a way to do it by using hg-fast-export.

$ git clone git://repo.or.cz/fast-export.git
$ mkdir new_git_repo
$ cd new_git_repo
$ git init
$ /path/to/hg-fast-export.sh -r /path/to/hg_repo
$ git checkout HEAD

(taken from here)

And that's it. Your hg repo is also left, and all the commit history is replicated in the git repo also.

© RainbowCoding 2010-2021