Boost logo

Boost :

Subject: Re: [boost] [git] Mercurial?
From: Martin Geisler (mg_at_[hidden])
Date: 2012-03-22 05:44:40

Mark Borgerding <mark_at_[hidden]> writes:

> On 03/21/2012 01:38 PM, Paul A. Bristow wrote:
>> [snip]
>> ... it is all too easy to find that changes collide.
>> I'm unclear how git alters that (if at all) I have yet to understand.
> Conflicts and merging happens. A merge in cvs or svn always caused me
> to get worried and annoyed, because there was a non-trivial chance I
> was going to lose something I wanted. It meant my code that I just
> spent some time working on has been hacked up and spit out by an
> automated merge routine. If I couldn't make sense of my code vs. the
> other guy's, I was in trouble.
> With mercurial, git and other DVCS's. The merge is different.
> *EVERYTHING IS SAVED ALREADY* There is no fear. You have two saved
> changesets, whose difference you wish to resolve.

That is an important difference: with Subversion you run

  $ svn commit

only to discover that someone else has touched a file you also touch.
You now need to run

  $ svn update

to get the changes from the repository and *merge* them into your
*uncommitted* changes. I know Subversion leaves .mine files behind, but
we're still talking about uncommited changes.

The normal way to avoid this in Subversion is to work on a branch. You
create the branch *up-front* and everybody promise each other that they
wont mess around in each others branches.

Mercurial and Git have a non-linear history at the core. There the
branch is created as needed and automatically if people push to the
central repository before you do. Afterwards, you can directly see what
happened in parallel and what happened in sequence.

> Often, the merge is simple and can be done automatically. Sometimes
> there are conflicts. You can work on those conflicts without worrying
> about losing any work.

You can even ask someone else to do the merge: he can pull your
committed changes into his repository and do the merge there. Maybe
someone restructured the code while you made some smaller changes. Than
that guy might be better at merging than you are.

Martin Geisler
aragost Trifork
Professional Mercurial support

Boost list run by bdawes at, gregod at, cpdaniel at, john at