{"thread":{"id":"34860","subject":"coming from git, understanding mercurial branching","startedAt":"2013-09-06T02:27:14Z","lastAt":"2013-09-08T00:42:46Z","messageCount":7,"participants":["Tim Chase","Tay Ray Chuan","Konstantin Khomoutov","Philip Oakley","Felipe Contreras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"226904","messageId":"20130905212714.636db4c4@bigbox.christie.dr","threadId":"34860","inReplyTo":null,"subject":"coming from git, understanding mercurial branching","fromName":"Tim Chase","fromEmail":"git@tim.thechases.com","sentAt":"2013-09-06T02:27:14Z","receivedAt":"2013-09-06T02:27:14Z","isPatch":false,"sender":{"key":"git@tim.thechases.com","avatar":null},"body":"I've got a pretty good grasp on git's rather straightforward\nbranching, but am trying to wrap my head around Mercurial's\nbranching.  There seem to be several flavors, some default to\npush-public, while others are private; some are tracked in history,\nwhile others seem more ephemeral; often the docs suggest cloning\ninstead of branching; detached heads seem more normal in the\nMercurial world.\n\nDo any git users here have good \"understanding Mercurial branches\nfor the git user\" resources they've found helpful when working with\nMercurial?  Preferably a \"for dummies\" resource with illustrations &\ncomparison charts so I can see the big picture.\n\nThanks\n\n-tkc\n\n\nPS: I've read a couple Mercurial resources including\nhttp://mercurial.selenic.com/wiki/GitConcepts\nbut it didn't really dig into comparing the mental models used in\nbranching.  \n"},{"id":"226908","messageId":"CALUzUxoa7Lw-_sj3LRj-9=hSh17hi+j4JhfAPKaDfhuE8PnKCA@mail.gmail.com","threadId":"34860","inReplyTo":"20130905212714.636db4c4@bigbox.christie.dr","subject":"Re: coming from git, understanding mercurial branching","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2013-09-06T04:39:59Z","receivedAt":"2013-09-06T04:39:59Z","isPatch":false,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"On Fri, Sep 6, 2013 at 10:27 AM, Tim Chase <git@tim.thechases.com> wrote:\n> I've got a pretty good grasp on git's rather straightforward\n> branching, but am trying to wrap my head around Mercurial's\n> branching.  There seem to be several flavors, some default to\n> push-public, while others are private; some are tracked in history,\n> while others seem more ephemeral;\n\nFirst: recognize Mercurial's branches are entirely different beasts\nfrom Git's. They just happen to be given a same sequence of\ncharacters, b-r-a-n-c-h. The similarities end there!\n\n> often the docs suggest cloning\n> instead of branching; detached heads seem more normal in the\n> Mercurial world.\n\nAre you referring to this?\n\n  $ hg clone https://... master\n  $ cd master\n  # hack...\n\n  $ cd ..\n  $ hg clone https://... fix1\n  $ cd fix1\n  # hack...\n\n  $ cd../master\n  $ hg pull ../fix1\n  $ hg merge ...\n\nIn git, you would have your master branch, checkout -b fix1, then\nmerge them back to master when you're done. The above describes how\none would do this in mercurial.\n\n-- \nCheers,\nRay Chuan\n"},{"id":"226938","messageId":"20130906082621.01162905@bigbox.christie.dr","threadId":"34860","inReplyTo":"CALUzUxoa7Lw-_sj3LRj-9=hSh17hi+j4JhfAPKaDfhuE8PnKCA@mail.gmail.com","subject":"Re: coming from git, understanding mercurial branching","fromName":"Tim Chase","fromEmail":"git@tim.thechases.com","sentAt":"2013-09-06T13:26:21Z","receivedAt":"2013-09-06T13:26:21Z","isPatch":false,"sender":{"key":"git@tim.thechases.com","avatar":null},"body":"On 2013-09-06 12:39, Tay Ray Chuan wrote:\n> First: recognize Mercurial's branches are entirely different beasts\n> from Git's. They just happen to be given a same sequence of\n> characters, b-r-a-n-c-h. The similarities end there!\n\nYeah, I'm trying to create a mental map between what Git means by\nbranching, and what Mercurial means by branching.  As you say, they\nseem to be entirely different beasts.\n\n> > often the docs suggest cloning instead of branching;\n> \n> Are you referring to this?\n> \n>   $ hg clone https://... master\n>   $ cd master\n>   # hack...\n> \n>   $ cd ..\n>   $ hg clone https://... fix1\n\nUsually I see this written as\n\n  $ cd ..\n  $ hg clone master fix1\n\nbut otherwise, yes.\n\n>   $ cd fix1\n>   # hack...\n> \n>   $ cd../master\n>   $ hg pull ../fix1\n>   $ hg merge ...\n> \n> In git, you would have your master branch, checkout -b fix1, then\n> merge them back to master when you're done. The above describes how\n> one would do this in mercurial.\n\nMercurial has this cloning-branch thing, a \"branch\" command, and\nsomething called \"bookmarks\" which all seem to have different\nbehaviors (and corresponding reasons to choose them) and yet all be\nloosely referred to as \"branching\".  Cloning litters the drive with\nduplicate checkouts (even if they use hard-linking for the repo\nbehind the scenes, there's still a lot of time spent writing.  The\ngit equiv of this hg suite would be almost identical, cloning a\nlocal checkout); the 2nd and 3rd are more branch-related and what I'm\ntrying to grok.\n\n-tkc\n"},{"id":"226941","messageId":"20130906175124.7d08947410503681449642ad@domain007.com","threadId":"34860","inReplyTo":"20130905212714.636db4c4@bigbox.christie.dr","subject":"Re: coming from git, understanding mercurial branching","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2013-09-06T13:51:24Z","receivedAt":"2013-09-06T13:51:24Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Thu, 5 Sep 2013 21:27:14 -0500\nTim Chase <git@tim.thechases.com> wrote:\n\n[...]\n> Do any git users here have good \"understanding Mercurial branches\n> for the git user\" resources they've found helpful when working with\n> Mercurial?  Preferably a \"for dummies\" resource with illustrations &\n> comparison charts so I can see the big picture.\n\nI found this guide [1] very useful back in the time I tried to grok\nMercurial.\n\n1. http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/\n"},{"id":"226949","messageId":"E27274C44BAD4DAE92D9D89AA9591CEF@PhilipOakley","threadId":"34860","inReplyTo":"20130906175124.7d08947410503681449642ad@domain007.com","subject":"Re: coming from git, understanding mercurial branching","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2013-09-06T16:40:21Z","receivedAt":"2013-09-06T16:40:21Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Konstantin Khomoutov\" <flatworm@users.sourceforge.net>\nTo: \"Tim Chase\" <git@tim.thechases.com>\n> On Thu, 5 Sep 2013 21:27:14 -0500\n> Tim Chase <git@tim.thechases.com> wrote:\n>\n> [...]\n>> Do any git users here have good \"understanding Mercurial branches\n>> for the git user\" resources they've found helpful when working with\n>> Mercurial?  Preferably a \"for dummies\" resource with illustrations &\n>> comparison charts so I can see the big picture.\n>\n> I found this guide [1] very useful back in the time I tried to grok\n> Mercurial.\n>\n> 1. \n> http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/\n> --\nTim,\nAnother recent blog is \nhttp://felipec.org/2013/08/27/analysis-of-hg-and-git-branches/ by Felipe \nContreras who wrote Git's official GitMercurial bridge; git-remote-hg\n\nPhilip \n"},{"id":"226979","messageId":"20130906142927.279a994a@bigbox.christie.dr","threadId":"34860","inReplyTo":"20130906175124.7d08947410503681449642ad@domain007.com","subject":"Re: coming from git, understanding mercurial branching","fromName":"Tim Chase","fromEmail":"git@tim.thechases.com","sentAt":"2013-09-06T19:29:27Z","receivedAt":"2013-09-06T19:29:27Z","isPatch":false,"sender":{"key":"git@tim.thechases.com","avatar":null},"body":"On 2013-09-06 17:51, Konstantin Khomoutov wrote:\n> I found this guide [1] very useful back in the time I tried to grok\n> Mercurial.\n> \n> 1.\n> http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/\n\nIndeed, after reading it, that's the most sense I've been able to make\nof Mercurial's strange branching.  I guess it boils down to the\nfollowing rough heuristic:\n\n- if you want to dink around locally, but don't want to publish your\n  branches (yet), default to bookmarks using \"hg bookmark\"\n\n- once you want a branch to be public, consider making a \"real\"\n  branch using \"hg branch\"\n\n- if you want complete isolation in case you screw up something like\n  merging, use a clone\n\n\nI still prefer Git's way, but at least I'm not left scratching my\nhead when I have to play with Mercurial branches.\n\nThanks, all.\n\n-tkc\n"},{"id":"227039","messageId":"CAMP44s3ypvEBWnsfN5c73wT8cvGhpTnd3vbmpPfn8GMb4FVLvQ@mail.gmail.com","threadId":"34860","inReplyTo":"20130906142927.279a994a@bigbox.christie.dr","subject":"Re: coming from git, understanding mercurial branching","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-09-08T00:42:46Z","receivedAt":"2013-09-08T00:42:46Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Fri, Sep 6, 2013 at 2:29 PM, Tim Chase <git@tim.thechases.com> wrote:\n> On 2013-09-06 17:51, Konstantin Khomoutov wrote:\n>> I found this guide [1] very useful back in the time I tried to grok\n>> Mercurial.\n>>\n>> 1.\n>> http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/\n\nI've written various blog posts about the subject:\n\nhttp://felipec.wordpress.com/2011/01/16/mercurial-vs-git-its-all-in-the-branches/\nhttp://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/\nhttp://felipec.wordpress.com/2013/08/27/analysis-of-hg-and-git-branches/\n\n> Indeed, after reading it, that's the most sense I've been able to make\n> of Mercurial's strange branching.  I guess it boils down to the\n> following rough heuristic:\n>\n> - if you want to dink around locally, but don't want to publish your\n>   branches (yet), default to bookmarks using \"hg bookmark\"\n\nKind of, but then they added support to push bookmarks, so now you can\nfetch and push them, so not exactly local.\n\nIn addition, they are starting to think on adding remote namespaces,\nlike in Git, except that jon/devel becomes jon@devel.\n\n> - once you want a branch to be public, consider making a \"real\"\n>   branch using \"hg branch\"\n\nNot necessarily. You can merge or rebase, so \"the public\" doesn't see\nthe bookmark.\n\n> - if you want complete isolation in case you screw up something like\n>   merging, use a clone\n\nI guess so. There's also the option of using the 'mq' extension, which\nI guess it's similar to quilt.\n\n-- \nFelipe Contreras\n"}]}