It's also been my experience that non-expert users don't understand the repository DAG model well enough to perform history rewriting reliably and without error, which I think is one reason these features are disabled by default.
Finally, as of Mercurial 2.1 they now have the concept of "phases" of commits which make local non-shared commits mutable whereas commits which have already been shared are immutable. This new feature is a first step to safer history editing operations becoming more mainstream mercurial commands.
I would disagree with the statement regarding history rewriting and non-expert users, to note two exceptions: Git's amend commits are extremely easy to explain and rebase is not that much harder for common cases. These same users are going to have issues with merges and rely on good tool support nearly as much in that situation, too.
What I think would be welcome in Git is the very nice phased commit feature you mentioned. That's a great example of where the concern should have been directed towards the UI rather than the operation.
Shelf isn't shipped with mercurial and it's really really painful without it: you make some changes to some wrong branch and now you need either shelf or major pain with rebase.
If non-expert users don't understand enough to do rebase, they're screwed: they better go cry in a corner since you can't solve any non-trivial scenarios without rebase and you're going to run into those all the time.
Not that I like git, but still. And since Eclipse plugin for SVN merges much better than both git and hg, I often wonder why do we bother at all :(
Shelf isn't that necessary because of mq, which is bundled by default. It is very feasible to use mq as a simple shelf substitute, much easier than using it for its more complex usage scenarios. Also, for your use case, it's pretty easy to hg diff your change to a file, switch branches, and then use the GNU patch command to apply your changes on top again, so you don't even need shelf or mq to do that if you haven't checked anything in.
cd $PROJECT
svn diff > ~/working-on-foo.patch
svn revert *
patch < ~/working-on-bar.patch
30 GOTO 10.
Ugh. Thinking about going back to that workflow makes me physically ill.Git (as Linus says) is a STUPID content tracker. 99.9% of the time when I'm working on source code, git allowing me to do stable, local "bookmarks", keep multiple local branches (and local history) active simultaneously, and keep all my content tracked... Git has its flaws and warts but don't seriously suggest that "svn diff > ~/working-on-foo.patch" is a valid workflow. That's bringing a knife to a gunfight.
I suggest that if you can understand a linked list, you can understand git. And if you're a programmer that can't understand a linked list... well... print out your "cheat sheet", here's a copy of Tortoise, and commit your code to a branch before it gets approved for main-line.
Mercurial has remote-trackable bookmarks now (something I felt they needed for a long time). I agree Mercurial's branch tracking in general isn't nearly as good as git's, local branches being the biggest example. There is a local branch extension for mercurial (http://mercurial.selenic.com/wiki/LocalbranchExtension), but having used it a long time ago I'm not sure I'm the biggest fan.
However, I firmly believe that mercurial is in the same league as git and both are more than good enough to get the job done, and each have their relative strengths and weaknesses. I also believe that the outspoken part of the git community tends to be overzealous and blind to git's faults and Mercurial's strengths.
"it's pretty easy to hg diff your change to a file, switch branches, and then use the GNU patch command to apply your changes on top again" It feels like mercurial developers wanted to inflict pain on me, and makes me want to hurt them in return. See, it's three steps. It's four actually, because you also want to delete the diff file.
You know how many steps did it take in SVN? Zero. When you switched branch, it just preserved all your changes and applied those back. You didn't have to do anything.
Maybe it didn't work when there was a conflict - once per 100 switches. But mercurial won't let you do that - that's 100 per 100 switches.
hg update <branchname>
will do exactly what you want. It's even the same command as in SVN.do
hg update default
get:
abort: crosses branches (merge branches or use --clean to discard changes)
So?
Because sometimes simplicity is a good thing? I'm not a Mercurial user, but there are plenty of times when decoupling features is a good thing- look at Mozilla Communicator Suite (or whatever it was called) vs. Firefox.
For the record, I use git every day and I'm yet to need rebase. No, my projects aren't all that complex, nor do they have a huge number of branches. But I suspect that is the case for a lot of other people, too.
If you don't use branches much (like most github users) you probably don't have this problem. We have version branches, so I do.
When I use git (I tend to use hg more because it's more friendly for Windows projects, where I often find myself), I generally work on master for personal projects where I'm the only committer. It's easier for that use case. Branches are primarily valuable, IMO, when you have multiple people bashing on it at once.
I think that most programmers will learn a little Git and then run away fleeing in terror and become all the more entrenched in their woeful belief that Subversion is adequate. In this sense, I think that Git is doing more harm than good. If the current buzz were for Mercurial, which is far more approachable than Git, I think that most Subversion users might try Mercurial out, think, "Hey, this is pretty nice!" and then be perfectly happy to switch. Git, on the other hand, offers all the power that anyone could ever need, but even I, who am pretty fluent with Git, often have no clue what other Git users are talking about when they explain how to do something. I never have that issue with Mercurial.
Also, I've never had any problem with histedit. Though hgsubversion has definitely caused me to get a few extra gray hairs from time to time.
Under the hood the two systems are very close. What differs is the interface, defaults and "taste". I think the Mercurial ones are a closer match for perpetual intermediates and smaller projects/teams while Git's choices are a closer match for expert users and larger teams/projects.
Use the best tool for the job and that closest matches the work being done and the team at hand. There is not one perfect answer.
- it is just a small team (less than 5 devs)
- there is no github, just a locally hosted gitorious instance (proprietary project)
- the lead dev who picks git is using Windows half the time
- there are less technical people who need commit rights (e.g. changing reports layout, changing CSS, etc)
I believe the "git already won" mentality (which is very apparent in the comments of both OP article and HN) get these people to pick git over mercurial. And once they become familiar with git, they won't let go, due to the sunk cost of learning gitology[1].
"Git encourages micro-management, and git’s users end up loving this micro-management (and blog about it, and write books, and have conferences, and so on ad-nauseum). This is characteristic of the perversion that git promotes, focussing on details instead of getting work done."
What does the author know about how much work any of those people get done? But I'm glad he wrote that; it made me feel much better about writing the rest off as a rant.
Regarding sunk costs, that's true of pretty much any sufficiently complex tool or technology. You could make the same case with Emacs vs. vi, or pretty much any programming language, API, or framework.
No, plenty of people like patch queues, including me. They are very good at what they do.
I prefer git overall, but let's not bash competing projects with huge overgeneralizations like "nobody really believes you should use [patch queues]".
I am happy to see phased commits - perhaps that'll start leading to a little more UI support for operations which historically were considered edgy.
That does not make me a happy camper. I use Git because of Github - GH is a very nice system. Hg IMO is a better interface if you just need to pick it up, hit it a few times, and then go do your thing.
Mind if I ask how you manage to easily kill changesets in a 'distressingly easy' manner?
In my experience it is somewhat difficult inadvertently lose commits (especially to lose them for good) unless you go out of your way to do so.
Another time came when I was trying to squash changesets, I managed to futz around with it to the point of absolutely killing a changeset. I don't know how I did that.
What this means in practice: when you need to rebase in Git, you simply do so. When you need to rebase in Mercurial, you have to enable a bunch of extensions which aren't well polished or documented because they're not part of the standard feature set and many people have been discouraged from using them. That second situation is far more likely to cause data loss, which is a pity because rewriting local history is a valid operation which often produces cleaner commits and avoids merge failures.
I started using Mercurial earlier than Git but have been using both for years. Mercurial remains the only one where I have experienced data-loss (histedit) and the one where I had to switch to a less natural workflow to deal with limitations of the tool (e.g. patch queues are such a kludge-fest it's obvious that nobody really believes you should use this feature).