Git wins :-(
Version control is a must.
I’ve been exposed to the hazards of data loss
since the age of 8 or so. My father let me keep some files on his Unix account
at that time, and once I discovered how directory trees worked, I put together
a nonsense maze of directories, something like
q1/q2/z/letter1; I don’t
remember. Anyway when he needed to move some things around, apparently
he didn’t realize they were directories rather than files, and they got
archived incorrectly. I don’t even remember what it was that I lost.
Two years later we got a Commodore 64, and for a while we had only a cassette recorder to save programs. That wasn’t very reliable. Then we got a floppy disk drive. Yay! And I typed in a character set editor program from Compute’s Gazette three times, because the first two times memory got corrupted somehow when I ran the program prior to saving it.
So I take data loss seriously. Version control lets you save your data somewhere, and it’s better than just a backup, because you can go back in time to an older version and see what changes you’ve made.
I briefly learned RCS for a summer job in college; it made these strange
,v files that I didn’t understand. I just followed the directions and my manager was happy.
When I started working after college, my employer used Visual SourceSafe from Microsoft. The data got corrupted every once in a while, so we started calling it SourceUnsafe. Yuck. A number of years after that, a spinoff company used StarTeam and my employer switched to SurroundSCM. StarTeam was too complex for me, and SurroundSCM was OK but such a niche....
One day when I was working on a small project in that company, a group of us started a renegade Subversion (aka SVN) server, and that’s where we kept our files. SVN was a breath of fresh air; the server was rock-solid, and zillions of people used it so you could easily get an answer to almost any questions. The only problem was, it had no user interface. You had to deal with the command line, or you had to use TortoiseSVN (which was okay, but basically just a thin UI wrapper around the command line), or one of the other motley crew of 3rd-party SVN front ends. I’d been used to some really nice UIs in StarTeam and SurroundSCM that made it much easier to propagate files across branches. But whatever.
I started using Mercurial (aka hg) in January 2009, and that was another breath of fresh air. You could start up a mini-repository in 30 seconds! No server needed! I started using hg for everything that didn’t fit nicely in SVN: Apache configuration files, Mediawiki configuration files (this is really important — nothing worse than breaking the config files and not being able to figure out how to go back to what worked), personal projects, etc. I looked at the gamut of distributed VCS out there. Mercurial and Git were the big ones. But Git didn’t work on Windows, in part because Git was from Linus Torvalds, who worked on Linux and shunned Windows the way Microsoft shunned non-Windows systems.
So Mercurial was my favorite DVCS. Easy to use, and Bitbucket gave you free repository hosting for personal and open-source projects! A few years later Atlassian bought Bitbucket, hosting both hg and git repositories, and released SourceTree for hg and git. So I had a nice system and UI to work with. Atlassian posted some articles on Git vs. Mercurial; one favoring Git and the other favoring Mercurial. I’m not going to argue about why I think Mercurial is better than Git. It’s a simpler interface: Git gives you more things you can do, and it’s more complex to do them.
Fast forward to 2015. Git won. I don’t like it, but that seems to be the fact of it:
GitHub has exploded in popularity. Their website is ridiculously easy to use and it just feels right. Nice look, straightforward UI, and you can do a lot without ever touching the command-line. Bitbucket, on the other hand, has really stalled… this is typical of an Atlassian product. People grow to love some piece of software or service of theirs, and there are major bug reports / feature requests that sit idle for years without any action from Atlassian. And GitHub (surprise!) hosts only Git repositories, not Mercurial. Bitbucket’s one remaining advantage is that if you want free private repositories for your own use, you can have them with Bitbucket, whereas GitHub requires you to pay a subscription.
Git got some good Windows support. You can now download native Git binaries for Windows and it’s just like using it on Linux or a Mac.
A huge number of major projects — Rust, Julia, Scala, matplotlib, numpy, scipy, pandas, jQuery, node.js — are hosted on GitHub. Firefox, Java OpenJDK, NetBeans and Python are exceptions; they live in Mercurial repositories on the sites of their respective organizations, though Python has a mirror on GitHub. Ruby lives in Subversion, with a mirror on GitHub. Other projects like Android and Go use Git hosted elsewhere.
In March 2015, Google Code announced it was shutting down. Although the project shutdown notice mentioned tools for migrating to both GitHub and Bitbucket, the built-in simple method for migration exports to GitHub. So if you’re short on time, boom, GitHub becomes the easier option.
In short, the network effect has taken over. People use Git because everyone else uses Git. There was a window of opportunity for Mercurial, with Bitbucket and Kiln providing hosting, and announcements of Firefox, Java JDK NetBeans Python moving to Mercurial. But GitHub scored big and made Git easy (or at least, easier).
I wish that there had been an equivalent champion of Mercurial the way GitHub has done for Git. Bitbucket dropped the ball (thanks Atlassian), and Kiln, despite lots of novel features, never marketed to the masses with a dual free/premium model the way GitHub did. (We considered Kiln in my former company but even their “free” trial required a credit card. You’d be amazed how large of a barrier to entry that is, when an alternative is truly free.)
So now I’m learning Git, because we are starting to use Git at my present employer, and all these open-source projects use Git, and because Git works well for publishing this blog to my webhosting service and I don’t know how to do the equivalent task in Mercurial.
All my other personal projects will still be in Mercurial, but it feels like I’m a second-class citizen, like speaking English in Quebec when everyone else is talking in French.
But I’m learning my French — this blog is stored in Git.