Moving from Mercurial to Git
06 Jun 2012For a while now I've been keeping my personal code repositories on BitBucket - which I'm really happy with - and using Mercurial as my source control tool of choice.
However since Bitbucket started also supporting Git - and that's what all the cool kids seem to be using nowadays - I'd thought I'd switch all my code over to Git to see what all the fuss is about.
Converting from Mercurial to Git
There are plenty of tools that in theory should help to export Mercurial changelist details to Git. However most of them didn't seem work very well on Windows, and the couple of things I tried didn't really work, so I was a bit stymied.
It's also slightly surprising that BitBucket don't offer tools to do Mercurial->Git the conversion, but to be honest I haven't drilled into the details and maybe it's not so straightforward?
After pondering for a bit, I decided to recreate my existing Mercurial repositories in Git by manually creating a new Git repository, then simply adding in the latest version of all the files.
There's an obvious drawback in what I did - I lost all of the change history of the existing Mercurial projects. However I decided there was really little of value for me as I'm really using Bitbucket just as an offsite backup right now, so it was OK to make the switch.
Using Git for Windows
The main reason I decided to take the plunge and move to Git was the release of what is a great new GitHub for Windows app released recently.
Phil Haack - ex-MSFT and now at GitHub - has a great blog post about what GitHub for Windows does, and another one about how to get it working for non-GitHub repositories, obviously useful for getting setup with the BitBucket repositories.
Other than a few issues with initialising the local repositories using the drag and drop functionality from Explorer which intermittently crashed the program - I think it was because they were initially empty - it all worked very smoothly.
The tool is very simple to use, and much easier than the command-line utilities I was used to in Mercurial, although power tools are there under the covers if necessary.
If you're using Git on Windows already I'd definitely recommend trying out the GitHub for Windows app, and a couple of days in I'm very happy I've made the move from Mercurial.
My first project on GitHub
Now I was all set, I decided to release my "Bing Translate to English Chrome Extension" on GitHub, just in case anyone was interested in how it worked or wanted to extend how it works. In the unlikely event that's you, feel free to drop me a line as I'm very happy to help in any way I can.