Mostly a note to myself as I forget it regularly.
The best way known to me to convert a Mercurial (hg) repo into a Git one is:
- get fast-export:
git clone git://repo.or.cz/fast-export.git /tmp/fast-export
- create the new git repo and cd into it:
git init new-repo; cd new-repo
- Import the hg repo:
/tmp/fast-export/hg-fast-export.sh -r path-of-hg-repo
- Checkout master:
git checkout master
- Optional: Convert your .hgignore to .gitignore. Mostly
git mv .hgignore .gitignoreand remove the
syntax: globfrom the top. If you’ve used regular expressions, you have to fix them by hand.