git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* coming from git, understanding mercurial branching
@ 2013-09-06  2:27 Tim Chase
  2013-09-06  4:39 ` Tay Ray Chuan
  2013-09-06 13:51 ` Konstantin Khomoutov
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Chase @ 2013-09-06  2:27 UTC (permalink / raw)
  To: git

I've got a pretty good grasp on git's rather straightforward
branching, but am trying to wrap my head around Mercurial's
branching.  There seem to be several flavors, some default to
push-public, while others are private; some are tracked in history,
while others seem more ephemeral; often the docs suggest cloning
instead of branching; detached heads seem more normal in the
Mercurial world.

Do any git users here have good "understanding Mercurial branches
for the git user" resources they've found helpful when working with
Mercurial?  Preferably a "for dummies" resource with illustrations &
comparison charts so I can see the big picture.

Thanks

-tkc


PS: I've read a couple Mercurial resources including
http://mercurial.selenic.com/wiki/GitConcepts
but it didn't really dig into comparing the mental models used in
branching.  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: coming from git, understanding mercurial branching
  2013-09-06  2:27 coming from git, understanding mercurial branching Tim Chase
@ 2013-09-06  4:39 ` Tay Ray Chuan
  2013-09-06 13:26   ` Tim Chase
  2013-09-06 13:51 ` Konstantin Khomoutov
  1 sibling, 1 reply; 7+ messages in thread
From: Tay Ray Chuan @ 2013-09-06  4:39 UTC (permalink / raw)
  To: Tim Chase; +Cc: Git Mailing List

On Fri, Sep 6, 2013 at 10:27 AM, Tim Chase <git@tim.thechases.com> wrote:
> I've got a pretty good grasp on git's rather straightforward
> branching, but am trying to wrap my head around Mercurial's
> branching.  There seem to be several flavors, some default to
> push-public, while others are private; some are tracked in history,
> while others seem more ephemeral;

First: recognize Mercurial's branches are entirely different beasts
from Git's. They just happen to be given a same sequence of
characters, b-r-a-n-c-h. The similarities end there!

> often the docs suggest cloning
> instead of branching; detached heads seem more normal in the
> Mercurial world.

Are you referring to this?

  $ hg clone https://... master
  $ cd master
  # hack...

  $ cd ..
  $ hg clone https://... fix1
  $ cd fix1
  # hack...

  $ cd../master
  $ hg pull ../fix1
  $ hg merge ...

In git, you would have your master branch, checkout -b fix1, then
merge them back to master when you're done. The above describes how
one would do this in mercurial.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: coming from git, understanding mercurial branching
  2013-09-06  4:39 ` Tay Ray Chuan
@ 2013-09-06 13:26   ` Tim Chase
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Chase @ 2013-09-06 13:26 UTC (permalink / raw)
  To: Git Mailing List

On 2013-09-06 12:39, Tay Ray Chuan wrote:
> First: recognize Mercurial's branches are entirely different beasts
> from Git's. They just happen to be given a same sequence of
> characters, b-r-a-n-c-h. The similarities end there!

Yeah, I'm trying to create a mental map between what Git means by
branching, and what Mercurial means by branching.  As you say, they
seem to be entirely different beasts.

> > often the docs suggest cloning instead of branching;
> 
> Are you referring to this?
> 
>   $ hg clone https://... master
>   $ cd master
>   # hack...
> 
>   $ cd ..
>   $ hg clone https://... fix1

Usually I see this written as

  $ cd ..
  $ hg clone master fix1

but otherwise, yes.

>   $ cd fix1
>   # hack...
> 
>   $ cd../master
>   $ hg pull ../fix1
>   $ hg merge ...
> 
> In git, you would have your master branch, checkout -b fix1, then
> merge them back to master when you're done. The above describes how
> one would do this in mercurial.

Mercurial has this cloning-branch thing, a "branch" command, and
something called "bookmarks" which all seem to have different
behaviors (and corresponding reasons to choose them) and yet all be
loosely referred to as "branching".  Cloning litters the drive with
duplicate checkouts (even if they use hard-linking for the repo
behind the scenes, there's still a lot of time spent writing.  The
git equiv of this hg suite would be almost identical, cloning a
local checkout); the 2nd and 3rd are more branch-related and what I'm
trying to grok.

-tkc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: coming from git, understanding mercurial branching
  2013-09-06  2:27 coming from git, understanding mercurial branching Tim Chase
  2013-09-06  4:39 ` Tay Ray Chuan
@ 2013-09-06 13:51 ` Konstantin Khomoutov
  2013-09-06 16:40   ` Philip Oakley
  2013-09-06 19:29   ` Tim Chase
  1 sibling, 2 replies; 7+ messages in thread
From: Konstantin Khomoutov @ 2013-09-06 13:51 UTC (permalink / raw)
  To: Tim Chase; +Cc: git

On Thu, 5 Sep 2013 21:27:14 -0500
Tim Chase <git@tim.thechases.com> wrote:

[...]
> Do any git users here have good "understanding Mercurial branches
> for the git user" resources they've found helpful when working with
> Mercurial?  Preferably a "for dummies" resource with illustrations &
> comparison charts so I can see the big picture.

I found this guide [1] very useful back in the time I tried to grok
Mercurial.

1. http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: coming from git, understanding mercurial branching
  2013-09-06 13:51 ` Konstantin Khomoutov
@ 2013-09-06 16:40   ` Philip Oakley
  2013-09-06 19:29   ` Tim Chase
  1 sibling, 0 replies; 7+ messages in thread
From: Philip Oakley @ 2013-09-06 16:40 UTC (permalink / raw)
  To: Tim Chase; +Cc: git, Konstantin Khomoutov

From: "Konstantin Khomoutov" <flatworm@users.sourceforge.net>
To: "Tim Chase" <git@tim.thechases.com>
> On Thu, 5 Sep 2013 21:27:14 -0500
> Tim Chase <git@tim.thechases.com> wrote:
>
> [...]
>> Do any git users here have good "understanding Mercurial branches
>> for the git user" resources they've found helpful when working with
>> Mercurial?  Preferably a "for dummies" resource with illustrations &
>> comparison charts so I can see the big picture.
>
> I found this guide [1] very useful back in the time I tried to grok
> Mercurial.
>
> 1. 
> http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/
> --
Tim,
Another recent blog is 
http://felipec.org/2013/08/27/analysis-of-hg-and-git-branches/ by Felipe 
Contreras who wrote Git's official GitMercurial bridge; git-remote-hg

Philip 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: coming from git, understanding mercurial branching
  2013-09-06 13:51 ` Konstantin Khomoutov
  2013-09-06 16:40   ` Philip Oakley
@ 2013-09-06 19:29   ` Tim Chase
  2013-09-08  0:42     ` Felipe Contreras
  1 sibling, 1 reply; 7+ messages in thread
From: Tim Chase @ 2013-09-06 19:29 UTC (permalink / raw)
  To: git

On 2013-09-06 17:51, Konstantin Khomoutov wrote:
> I found this guide [1] very useful back in the time I tried to grok
> Mercurial.
> 
> 1.
> http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

Indeed, after reading it, that's the most sense I've been able to make
of Mercurial's strange branching.  I guess it boils down to the
following rough heuristic:

- if you want to dink around locally, but don't want to publish your
  branches (yet), default to bookmarks using "hg bookmark"

- once you want a branch to be public, consider making a "real"
  branch using "hg branch"

- if you want complete isolation in case you screw up something like
  merging, use a clone


I still prefer Git's way, but at least I'm not left scratching my
head when I have to play with Mercurial branches.

Thanks, all.

-tkc

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: coming from git, understanding mercurial branching
  2013-09-06 19:29   ` Tim Chase
@ 2013-09-08  0:42     ` Felipe Contreras
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2013-09-08  0:42 UTC (permalink / raw)
  To: Tim Chase; +Cc: git

On Fri, Sep 6, 2013 at 2:29 PM, Tim Chase <git@tim.thechases.com> wrote:
> On 2013-09-06 17:51, Konstantin Khomoutov wrote:
>> I found this guide [1] very useful back in the time I tried to grok
>> Mercurial.
>>
>> 1.
>> http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

I've written various blog posts about the subject:

http://felipec.wordpress.com/2011/01/16/mercurial-vs-git-its-all-in-the-branches/
http://felipec.wordpress.com/2012/05/26/no-mercurial-branches-are-still-not-better-than-git-ones-response-to-jhws-more-on-mercurial-vs-git-with-graphs/
http://felipec.wordpress.com/2013/08/27/analysis-of-hg-and-git-branches/

> Indeed, after reading it, that's the most sense I've been able to make
> of Mercurial's strange branching.  I guess it boils down to the
> following rough heuristic:
>
> - if you want to dink around locally, but don't want to publish your
>   branches (yet), default to bookmarks using "hg bookmark"

Kind of, but then they added support to push bookmarks, so now you can
fetch and push them, so not exactly local.

In addition, they are starting to think on adding remote namespaces,
like in Git, except that jon/devel becomes jon@devel.

> - once you want a branch to be public, consider making a "real"
>   branch using "hg branch"

Not necessarily. You can merge or rebase, so "the public" doesn't see
the bookmark.

> - if you want complete isolation in case you screw up something like
>   merging, use a clone

I guess so. There's also the option of using the 'mq' extension, which
I guess it's similar to quilt.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-08  0:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06  2:27 coming from git, understanding mercurial branching Tim Chase
2013-09-06  4:39 ` Tay Ray Chuan
2013-09-06 13:26   ` Tim Chase
2013-09-06 13:51 ` Konstantin Khomoutov
2013-09-06 16:40   ` Philip Oakley
2013-09-06 19:29   ` Tim Chase
2013-09-08  0:42     ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).