Converting Mercurial repositories to Git
-
Install Mercurial 1.7.5. Later versions may work, but that’s what I use.
-
Install hg-git (a Mercurial extension). I’m not exactly sure what version I use, all I can say is that the version does matter, different hg-git versions work (or not) with different Mercurial versions. A link to more information about finding the right combination is at the bottom of the hg-git page.
-
Install git (latest version is fine).
-
Create a “bare” git repository, like this:
Terminal window git init --bare myrepo.git -
“Push” the hg repo to the git repo:
Terminal window hg push /path/to/myrepo.git -
If everything went well, you can now clone the Git repo to get your files back:
Terminal window git clone /path/to/myrepo.git myrepo