importing from hg to git

Had to import a repository from Mercurial to Git today.

I used fast-export:

git clone git://

Because the author fields were an utter mess, I needed to create an authors map. This is not well documented but it’s of the form email address to author <email>. For example:

Administrator@MACHINE.localdomain=Bob McBadgers <> McBadgers <>
badgerbob@MyMachine=Bob McBadgers <>

You then create a new git repo, e.g.

mkdir myapp.git ; cd myapp.git
git init --bare --shared=group
../fast-export/ -A ../ -r ../myapp.hg/

If it produces an empty repo, ensure you have the Mercurial Python modules available.

Author: Danielle

Danielle is an Australian software engineer, computer scientist and feminist. She doesn't really work on GNOME any more (sadly). Opinions and writing are solely her own and so not represent her employer, the GNOME Foundation, or anyone else but herself.