5 ms·
I use both extensively (git for most personal projects, Mercurial at work), so I feel like chiming in here. I really do think that Mercurial's user interface i
by Niten 14y ago
I use both extensively (git for most personal projects, Mercurial at work), so I feel like chiming in here.
I really do think that Mercurial's user interface is easier for beginners to pick up, and more difficult to shoot oneself in the foot with. It's the little things, like the fact that Mercurial's push and pull commands do exactly the opposite of one another, that hg clone/pull URLs are identical to what you type into a web browser to browse the repo, and the ease of dealing with Mercurial "bare" repositories (hg up -r null) for mirroring and backup purposes.
And the way Mercurial's command-line interface strongly discourages one from modifying history; it makes it harder for things to get messed up on a small team coordinating with a shared-access repo. Yes, I know git has the reflog, but in general people seem to have much fewer "OMG WHAT JUST HAPPENED TO MY BRANCH" moments with Mercurial than with git. That (along with mq, which provided a unique solution to our team's needs) was the major reason I chose Mercurial over git at work. If we're going to brandish about the term "UX" here, then I'd say Mercurial definitely has a better "UX" than git.
But Mercurial has pain points, too. The biggest one, in my opinion, is the way branches work: Mercurial started out with named branches, which it seems the community has recognized as a mistake, and has moved to replace with git-style branches (called "bookmarks" in Mercurial land). These work better, but there are still some drawbacks: for one thing, Mercurial lacks the notion of a "remote", so unlike in git your local bookmarks and remote bookmarks have to share the same namespace. This leads to counter-intuitive behavior when it comes to synchronizing bookmarks with a remote server, and often you'll find that bookmarks aren't necessarily updated when you'd expect them to be.
Additionally, the notion of a "tip" makes working with feature branches frustrating, because by default Mercurial will check out from whatever branch was pushed to most recently, rather than a de-facto standard "master" as in git. Hand in hand with this complaint, by default Mercurial will want to push all your changesets, not just those under your current working bookmark, so you have to constantly specify e.g. "hg push -r master" to keep from pushing local throw-away branches. And it's not easy to delete local throw-away branches if you decide you don't want them (the downside of Mercurials aversion toward history modification), so one generally winds up using a separately-cloned repo for temporary work, which is unfortunate in contrast with git.
Mercurial and git are both great, efficient, high-performance tools. But if I had to generalize, I'd say that Mercurial is better for beginners and for "enterprisey" usage, whereas git, despite its interface inconsistencies, can be more powerful once you fully understand it and its data model (but only if you aren't working primarily on Windows, and don't need Mercurial Queues).
- alwillis 14y agoFrom what I can see, Mercurial actually has more flexibility when it comes to branching: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-me...
- Niten 14y agoMore options, certainly, but I find git to be much more painless in this regard. Mercurial doesn't have anything equivalent to git's convenient workflow for creating temporary, local throwaway branches, without changing to a new working directory.
- alwillis 14y agoYou mean like Mercurial bookmarks? Branching with bookmarks is very close to the way git usually handles branching. Mercurial bookmarks are like git refs: named pointers to changesets that move on commit.
- Niten 14y agoBut like I explained in detail above, using Mercurial bookmarks it is tedious to avoid pushing your throw-away branch to the main repository, and you can't simply delete the branch when you're done with it. Git is much superior in this regard.
- npsimons 14y agobut only if you aren't working primarily on Windows Again, I'll admit I'm biased (I'm mostly a Linux guy), but for the day job, they are currently paying me to develop stuff for Windows, and both myself (via Cygwin), and my current coding partner (via MSysGit) have no issues whatsoever with Git in Windows. A previous team member also quickly adapted to Git via TortoiseGit. The flexibility of being able to rewrite history, the staging area, stashes and branching quickly are just too powerful, and being both code monkeys and CLI junkies, we don't miss the "integration" much (albeit, I love EGG: https://github.com/byplayer/egg https://github.com/byplayer/egg).