Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert a Mercurial Repository to Git

Tags:

git

mercurial

I've already tried hg2git through fast-export and I've already tried hg-git.

Both with no success. hg2git actually worked, but I had to ask a friend who runs a Unix machine to do it. And that messed up all the linefeeds throughout the files.

hg-git simply failed with some libzip compression error.

Has anyone had any success converting a hg repo to git on Windows?

To be clear, I don't care about interop. I want to port the whole repo from hg to git, taking the history with me. I don't need to push changes back and forth - only convert once.

like image 254
Tigraine Avatar asked Sep 07 '09 12:09

Tigraine


People also ask

Is Mercurial better than Git?

Git Is Better for Experienced Users Mercurial depends on your level of technical expertise. Mercurial may be safer for less experienced users, but Git can offer ways to enhance safety (once you know what you are doing).


1 Answers

Did the following on my Mac to successfully export a Mercurial repo to Git (with full branches):

mkdir myrepo; cd myrepo; git clone git://repo.or.cz/fast-export.git . rm -rf .git .gitignore git init ./hg-fast-export.sh -r ../path/to/local/hg/repo git clean -f # remove fast-export files 
like image 56
Mauvis Ledford Avatar answered Sep 28 '22 04:09

Mauvis Ledford