Migrate from Mercurial (hg) to Github

Tech Notes

At the beginning of time we use Mercurial for version control. At the time we were using a lot of remote developers. When you asked "do you use Git?" and they replied "Yes" meaning "I know what Github is" you could generally expect that if you asked "do you use Mercurial?" they'd draw a blank. So we switch to Git (and soon after to Github).

Many years have passed. From time to time we need to revisit a project. Up until now I'd just `git init` inside a Mercurial project and make my peace with the gods of history. No longer. 

Create a new respository at Github, clone the existing repository, install and configure hg-git, set the default git branch, copy the ignore file, then push it up. Sit back and have a cup of tea.

See http://arr.gr/blog/2011/10/bitbucket-converting-hg-repositories-to-git/


$ hg clone ssh://user@repo/path/to/repo my-repo && cd my-repo
$ sudo pip install hg-git
$ cat ~/.hgrc
[extensions]
hggit=
$ hg bookmark -r default master
$ hg push git+ssh://git@github:my-user/my-repo.git
$ cp .hgignore .gitignore
$ hg add .gitignore
$ hg commit -m "Add git ignore."
$ hg bookmark -r default master
$ hg push git+ssh://git@github:my-user/my-repo.git