Converting a mercurial repository into a git repository
Von Carsten
Today I cloned a mercurial repository, because I’m using an android application that I may have some contributions for. The project is hosted on Google Code and is using a mercurial repository since the beginning. I’m a git user myself, so I don’t want to give up my practiced workflows.
After trying hg-git without success, I found hg-fast-export. With this little tool I was able to convert the cloned mercurial repository into a git repository:
git clone git://repo.or.cz/fast-export.git
hg clone URL_TO_ORIGINAL_REPOSITORY
mkdir my-new-git-repository
cd my-new-git-repository
git init
PATH_TO_FASTEXPORT/hg-fast-export.sh -r ../NAME_OF_ORIGINAL_REPOSITORY --force
After this little dance I got a valid git repository with history, tags and branches. hg-fast-export should be able to do incremental imports, so I’m curious how it will handle my own local changes and incoming changes from the mercurial upstream later.