After years of resistance, I recently moved all my projects to Git from Mercurial (HG). In this post, I’ll talk about why I started with Mercurial and why Git won me over.
In 2009, I joined a new team at Microsoft called LiveLabs, back then the team was under Ray Ozzie’s org and they had an exception to use whatever tools they want, so we adopted Joel Spolsky’s tools made by his company FogCreek and Mercurial goes hand in hand with their build system Kiln and bug tracking FogBugz and wiki. Even the Mercurial tutorial is written by Spolsky http://hginit.com/
“Behind the scenes: Microsoft had it’s own internal tools to manage source code, builds, bug tracking, code review, but they were all shitty. For example, we used something called Source Depot, where back then,TFS (Team Foundation Server) did not exist and Git was not endorsed by the company ”
Spent a couple of years using Mercurial until LiveLabs team got dismantled then all the other Microsoft teams that I joined, either were still using Source Depot (shoot me) or they started migrating to the brand new TFS system which is similar to SVN. Until I joined Yammer and started using Git in a professional environment where I started to understand more the appeal and power of branching, pull requests, …etc
So Mercurial and Git are not very different, there are just some minor nuances which didn’t play a strong case for me to switch from a system that I’m already familiar and comfortable with until recently the advantages of Git over Mercurial increased and I’ll enumerate them here.
Today, the winners in my opinion are GitHub for open source projects and Bitbucket for small startups, and they’re both great for established startups and large teams. Unfortunately, FogCreek wasn’t startup friendly few years ago, I just checked the website and they’re now providing Kiln for free for up to 2 team members, and I’m not sure how long ago they’ve added that offering, positive step towards embracing startups.
GitHub: Perfect for open source projects, you can have unlimited contributors to unlimited public repositories.
Bitbucket: Perfect for small teams, you can have unlimited private repositories with up to 5 contributors for free.
Kiln: Perfect for small to large organizations? I haven’t used Kiln or Fogbugz in a while, here are the two things that I remember, it wasn’t cheap but it’s the best tools I’ve seen. If you follow Joel’s blog and read his book “Smart and get things done”, you’ll realize that he has built an organization around the smartest and brightest engineers.
Visual Studio Online: Supports GIT and TFS. Includes a build system, load testing engine, app monitoring and analytics.
Your Own: Many systems allow you to host your own inside your organization, like github for enterprise, kiln, …etc This approach is more typical in large teams.
Xcode: Native git support, I don’t believe HG can be installed. More details here: http://www.raywenderlich.com/51351/how-to-use-git-source-control-with-xcode-in-ios-7
Microsoft Visual Studio: In Visual Studio 2015, Microsoft upped their game with an amazing native git support. Note, hg can be installed as an extension, there are some paid and some free, but they’re not as good as the native Git support. Details here: https://www.visualstudio.com/en-us/get-started/code/share-your-code-in-git-vs and here https://channel9.msdn.com/posts/GitForVisualStudioTFS
Android Studio: Support for multiple source control systems, including Git, Mercurial, SVN and others. More about here: http://wii.logdown.com/posts/2013/11/15/android-studio-git-tutorial
Git Flow: Probably the best branching model I’ve personally seen in my whole career, read more about it here http://nvie.com/posts/a-successful-git-branching-model/ . Note: There is a replica called HG flow for Mercurial, I briefly used it and faced tons of issues.
Git Credential Manager for Windows: Setting up ssh on Windows is inconvenient, I’ve used pageant for quite sometime where I wrote a script to automatically open it and load the key. An alternative is to use http route and use the credentials manager found here https://github.com/Microsoft/Git-Credential-Manager-for-Windows to save the password.
Posh-git: A powershell environment for git, it shows which branch you’re on and supports tab auto completion
Github Desktop app: Built by github to bring a visual interface to manage primarily your github/git repositories
SourceTree: Built by Atlassian and allows you to manage your Git or Hg repositories.
There is an amazing guide on how to migrate from major source control systems to git, fortunately, since Git and Mercurial are very alike, the migration is very straight forward and you won’t lose your history. http://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git
In closing, I’m so far happy with my choice to adopt Git, I do miss “hg st” and “hg up”. Let me know in the comments about your favorite git tools, also let me know if I missed something.