hg-fast-export: convert Mercurial repositories to git repositories
There are *-to-git conversion tools for converting almost every SCM repository to a git repository.
I used hg quite extensively earlier this year, but switched to git within the last couple months. This is partly because I’ve found that git is much faster (on linux) and because it’s easier for me to wrap my mind around the the git philosophy of branching vs. hg’s. I had to dig up an old mercurial repository from an old project today and was decided to convert it to git.
Here’s what I had to do:
$ 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
A couple notes:
- I had to run hg-fast-export.sh instead of hg-fast-import.sh, contrary to what the README said. Typo?
- It doesn’t check out a working copy for you (it’s a feature, not a bug🙂 ), so I had to do it myself in the last step.
- I found that hg-fast-export works better than hg-to-git. I had some problems converting very large hg repositories. Maybe it’s preformance-related as hg-fast-export uses the Mercurial and git python libs directly while hg-to-git uses some combination of shell and python.