Keeping with the exodus from SVN/Mercurial to git, here is a super quick guide for converting a Mercurial repo to git.
Get the fast-export script via git:
git clone git://repo.or.cz/fast-export.git
Make a new (empty) git repo for the project that is currently in Mercurial
git init projectname.git
Use fast-export to do the convertion
$ cd projectname.git $ /path/to/fast-export.git/hg-fast-export.sh -r /path/to/project.hg git checkout master
(Optionally) use rsync to bring over uncommitted changes
rsync -av --delete-after --exclude=.git --exclude=.hg /path/to/project.hg /path/to/project.git
Enjoy your new git repo :)
I’ve only followed these steps on projects that are in their infancy, and were used as Mercurial experiments. I’m not sure how well branches and tags will be handled by the script. Any feedback would be welcome.