{"thread":{"id":"24017","subject":"DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","startedAt":"2010-06-05T11:09:30Z","lastAt":"2010-06-08T18:13:53Z","messageCount":34,"participants":["Clemens Buchacher","Sverre Rabbelier","Nicolas Pitre","Jeff King","Matthieu Moy","Jacob Helwig","Johan Herland","Miles Bader","Paolo Bonzini","Bruce Stephens","Jan Krüger","demerphq","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"143030","messageId":"20100605110930.GA10526@localhost","threadId":"24017","inReplyTo":null,"subject":"DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-05T11:09:30Z","receivedAt":"2010-06-05T11:09:30Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Hi,\n\nPeter and I just stumbled on the following interpretations of the\ncheckout command.\n\n git checkout origin/frotz      -> detaches HEAD\n git checkout -t origin/frotz   -> git checkout -b frotz origin/frotz\n git checkout frotz             -> git checkout -b frotz origin/frotz\n git checkout -t frotz          -> fatal: Missing branch name\n\nI was surprised by the third one, which I was expecting to fail.\nApparently it's a DWIM feature introduced in commit 70c9ac2f. I\ndoubt that is what the user was trying to do if they ran that\ncommand. If anything, this behavior will serve to confuse them.\n\nI think git checkout -t <remote>/<branch> is short enough for\ncreating a new tracking branch. For something even shorter, we can\ncreate an alias. But I'd prefer to keep the already complex\ncheckout command a little simpler.\n\nRegards,\nClemens\n"},{"id":"143033","messageId":"AANLkTilbg2nGr_sVmJLboMgXbas_qsB4V6gYxDxcDgKy@mail.gmail.com","threadId":"24017","inReplyTo":"20100605110930.GA10526@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-06-05T13:29:48Z","receivedAt":"2010-06-05T13:29:48Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Jun 5, 2010 at 13:09, Clemens Buchacher <drizzd@aon.at> wrote:\n> I think git checkout -t <remote>/<branch> is short enough for\n> creating a new tracking branch. For something even shorter, we can\n> create an alias. But I'd prefer to keep the already complex\n> checkout command a little simpler.\n\nYou're a little late to the party ;). Did you read the original thread\ndiscussing this?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"143035","messageId":"20100605135811.GA14862@localhost","threadId":"24017","inReplyTo":"AANLkTilbg2nGr_sVmJLboMgXbas_qsB4V6gYxDxcDgKy@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-05T13:58:11Z","receivedAt":"2010-06-05T13:58:11Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sat, Jun 05, 2010 at 03:29:48PM +0200, Sverre Rabbelier wrote:\n>\n> On Sat, Jun 5, 2010 at 13:09, Clemens Buchacher <drizzd@aon.at> wrote:\n> > I think git checkout -t <remote>/<branch> is short enough for\n> > creating a new tracking branch. For something even shorter, we can\n> > create an alias. But I'd prefer to keep the already complex\n> > checkout command a little simpler.\n> \n> You're a little late to the party ;). Did you read the original thread\n> discussing this?\n\nWell, I just noticed this by accident, it is not documented\nanywhere, and you cannot expected me to know everything that is\ngoing on on the list. Should I not offer my opinion because of\nthat?\n\nI could not make much sense of the thread that came with the patch.\nThe discussion first seems to conclude that it is a bad idea, only\nto implement it anyway.\n\nWell, I also think it is a bad idea, and I am not surprised to find\nusers confused by it.\n"},{"id":"143036","messageId":"AANLkTikE5BPD_DDqwEvPGxsMAIQCulpVwRKaCSnULcoP@mail.gmail.com","threadId":"24017","inReplyTo":"20100605135811.GA14862@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-06-05T14:03:30Z","receivedAt":"2010-06-05T14:03:30Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Jun 5, 2010 at 15:58, Clemens Buchacher <drizzd@aon.at> wrote:\n> Well, I just noticed this by accident, it is not documented\n> anywhere, and you cannot expected me to know everything that is\n> going on on the list. Should I not offer my opinion because of\n> that?\n\nNo, I just meant that because you are late to the party you should\nfirst read the original thread, and then perhaps summarize it, like\nyou have done below.\n\n> I could not make much sense of the thread that came with the patch.\n> The discussion first seems to conclude that it is a bad idea, only\n> to implement it anyway.\n\nI think it would be useful here to have some links to relevant posts,\nor at least to the relevant thread.\n\n> Well, I also think it is a bad idea, and I am not surprised to find\n> users confused by it.\n\nI think it was an idea from the last mentor summit, Peff?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"143039","messageId":"20100605150225.GA16594@localhost","threadId":"24017","inReplyTo":"AANLkTikE5BPD_DDqwEvPGxsMAIQCulpVwRKaCSnULcoP@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-05T15:02:25Z","receivedAt":"2010-06-05T15:02:25Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sat, Jun 05, 2010 at 04:03:30PM +0200, Sverre Rabbelier wrote:\n> On Sat, Jun 5, 2010 at 15:58, Clemens Buchacher <drizzd@aon.at> wrote:\n> \n> > I could not make much sense of the thread that came with the patch.\n> > The discussion first seems to conclude that it is a bad idea, only\n> > to implement it anyway.\n> \n> I think it would be useful here to have some links to relevant posts,\n> or at least to the relevant thread.\n\nThe discussion ends with this posting\nhttp://mid.gmane.org/7viqesz3mk.fsf@alter.siamese.dyndns.org ,\nwhich basically says \"we all agree this is bad.\"\n\nThen Junio changes his mind his mind and posts the patches.\nhttp://mid.gmane.org/7vzl7pyvzl.fsf@alter.siamese.dyndns.org\n\nWhether the feature has merit or not is suddenly not an issue any\nmore and the discussion veers off in other directions about minor\ntechnical details and about the --nodwim/--noguess option, the\nnotion of which I find ridiculous by the way. But it further\nillustrates how random and anti-DWIM this feature really is.\n"},{"id":"143048","messageId":"alpine.LFD.2.00.1006051423000.30664@xanadu.home","threadId":"24017","inReplyTo":"20100605150225.GA16594@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Nicolas Pitre","fromEmail":"nico@fluxnic.net","sentAt":"2010-06-05T18:23:26Z","receivedAt":"2010-06-05T18:23:26Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Sat, 5 Jun 2010, Clemens Buchacher wrote:\n\n> On Sat, Jun 05, 2010 at 04:03:30PM +0200, Sverre Rabbelier wrote:\n> > On Sat, Jun 5, 2010 at 15:58, Clemens Buchacher <drizzd@aon.at> wrote:\n> > \n> > > I could not make much sense of the thread that came with the patch.\n> > > The discussion first seems to conclude that it is a bad idea, only\n> > > to implement it anyway.\n> > \n> > I think it would be useful here to have some links to relevant posts,\n> > or at least to the relevant thread.\n> \n> The discussion ends with this posting\n> http://mid.gmane.org/7viqesz3mk.fsf@alter.siamese.dyndns.org ,\n> which basically says \"we all agree this is bad.\"\n> \n> Then Junio changes his mind his mind and posts the patches.\n> http://mid.gmane.org/7vzl7pyvzl.fsf@alter.siamese.dyndns.org\n> \n> Whether the feature has merit or not is suddenly not an issue any\n> more and the discussion veers off in other directions about minor\n> technical details and about the --nodwim/--noguess option, the\n> notion of which I find ridiculous by the way. But it further\n> illustrates how random and anti-DWIM this feature really is.\n\nAmen.\n\n\nNicolas\n"},{"id":"143087","messageId":"20100606161805.GA6239@coredump.intra.peff.net","threadId":"24017","inReplyTo":"AANLkTikE5BPD_DDqwEvPGxsMAIQCulpVwRKaCSnULcoP@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-06-06T16:18:05Z","receivedAt":"2010-06-06T16:18:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jun 05, 2010 at 04:03:30PM +0200, Sverre Rabbelier wrote:\n\n> On Sat, Jun 5, 2010 at 15:58, Clemens Buchacher <drizzd@aon.at> wrote:\n> > Well, I just noticed this by accident, it is not documented\n> > anywhere, and you cannot expected me to know everything that is\n> > going on on the list. Should I not offer my opinion because of\n> > that?\n> \n> No, I just meant that because you are late to the party you should\n> first read the original thread, and then perhaps summarize it, like\n> you have done below.\n\nMoreover, the burden for arguing against it is a little higher. It is no\nlonger \"I think this is a bad idea\" but \"I think this is a bad idea, and\nit is so bad that it is worth changing behavior that users may have\nbecome accustomed to\".\n\n> > Well, I also think it is a bad idea, and I am not surprised to find\n> > users confused by it.\n> \n> I think it was an idea from the last mentor summit, Peff?\n\nNo, I complained about it at the mentor summit, but the idea predates\nit. I think all of the relevant discussion is on the list.\n\n-Peff\n"},{"id":"143088","messageId":"vpqljas5e33.fsf@bauges.imag.fr","threadId":"24017","inReplyTo":"20100605110930.GA10526@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-06T16:18:56Z","receivedAt":"2010-06-06T16:18:56Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n> Hi,\n>\n> Peter and I just stumbled on the following interpretations of the\n> checkout command.\n>\n>  git checkout origin/frotz      -> detaches HEAD\n>  git checkout -t origin/frotz   -> git checkout -b frotz origin/frotz\n>  git checkout frotz             -> git checkout -b frotz origin/frotz\n>  git checkout -t frotz          -> fatal: Missing branch name\n>\n> I was surprised by the third one, which I was expecting to fail.\n> Apparently it's a DWIM feature introduced in commit 70c9ac2f. I\n> doubt that is what the user was trying to do if they ran that\n> command. If anything, this behavior will serve to confuse them.\n\nAs already mentionned, it's obviously a bit late to revert the commit\nwhich itroduced this DWIM. I tend to agree that this is confusing, but\nstill, this is very often what the user actually wanted. The original\npatch was to sugest the user the appropriate command, and I find the\nmotivating example rather convincing:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/129587\n\n$ git clone git://git.kernel.org/pub/scm/git/git.git\n$ cd git\n$ git checkout next\nerror: pathspec 'next' did not match any file(s) known to git.\nTo create a local branch from the same named remote branch, use\n  git checkout -b next origin/next\n\nThe newbie does not immediately understand the difference between\nlocal and remote branches, he's been told about the branch \"next\", and\nwants to check it out.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"143089","messageId":"20100606164642.GA10104@localhost","threadId":"24017","inReplyTo":"vpqljas5e33.fsf@bauges.imag.fr","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-06T16:46:42Z","receivedAt":"2010-06-06T16:46:42Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sun, Jun 06, 2010 at 06:18:56PM +0200, Matthieu Moy wrote:\n\n> $ git clone git://git.kernel.org/pub/scm/git/git.git\n> $ cd git\n> $ git checkout next\n> error: pathspec 'next' did not match any file(s) known to git.\n> To create a local branch from the same named remote branch, use\n>   git checkout -b next origin/next\n> \n> The newbie does not immediately understand the difference between\n> local and remote branches, he's been told about the branch \"next\", and\n> wants to check it out.\n\nThat is exactly my point. Trying to read the user's mind is not a\nsolution to this problem. The user does not even know what they are\ndoing and will inevitably end up even more confused.\n\nThe suggestion above would be perfect. It is an easy and obvious\nsolution, and the user is even educated about their mistake.\n"},{"id":"143090","messageId":"20100606165554.GB10104@localhost","threadId":"24017","inReplyTo":"20100606161805.GA6239@coredump.intra.peff.net","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-06T16:55:54Z","receivedAt":"2010-06-06T16:55:54Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sun, Jun 06, 2010 at 12:18:05PM -0400, Jeff King wrote:\n\n> Moreover, the burden for arguing against it is a little higher. It is no\n> longer \"I think this is a bad idea\" but \"I think this is a bad idea, and\n> it is so bad that it is worth changing behavior that users may have\n> become accustomed to\".\n\nI argue that people are more likely to be surprised and confused by\nthis feature rather than being accustomed to it already. I am also\nwaiting to hear from someone who actively uses this feature.\n"},{"id":"143091","messageId":"AANLkTinTI3XaE6P_WZ_k56fgI4LNOLSalv_1GlVZNO7n@mail.gmail.com","threadId":"24017","inReplyTo":"20100606165554.GB10104@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2010-06-06T16:59:08Z","receivedAt":"2010-06-06T16:59:08Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Sun, Jun 6, 2010 at 09:55, Clemens Buchacher <drizzd@aon.at> wrote:\n> On Sun, Jun 06, 2010 at 12:18:05PM -0400, Jeff King wrote:\n>\n>> Moreover, the burden for arguing against it is a little higher. It is no\n>> longer \"I think this is a bad idea\" but \"I think this is a bad idea, and\n>> it is so bad that it is worth changing behavior that users may have\n>> become accustomed to\".\n>\n> I argue that people are more likely to be surprised and confused by\n> this feature rather than being accustomed to it already. I am also\n> waiting to hear from someone who actively uses this feature.\n>\n\nI am someone that \"actively\" uses this feature.  I will often have\nrepositories that I use on multiple machines, and will forget which\nremote branches I have local tracking branches for, on which machines.\n I'll end up just doing `git checkout $random-branch`, thinking I'm on\none of the machines where I've already setup the local branch, and\nfind it quite handy that Git _does_ DWIM.\n"},{"id":"143092","messageId":"20100606173233.GA11041@localhost","threadId":"24017","inReplyTo":"AANLkTinTI3XaE6P_WZ_k56fgI4LNOLSalv_1GlVZNO7n@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-06T17:32:33Z","receivedAt":"2010-06-06T17:32:33Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sun, Jun 06, 2010 at 09:59:08AM -0700, Jacob Helwig wrote:\n> On Sun, Jun 6, 2010 at 09:55, Clemens Buchacher <drizzd@aon.at> wrote:\n> >\n> > I argue that people are more likely to be surprised and confused by\n> > this feature rather than being accustomed to it already. I am also\n> > waiting to hear from someone who actively uses this feature.\n> >\n> \n> I am someone that \"actively\" uses this feature.  I will often have\n> repositories that I use on multiple machines, and will forget which\n> remote branches I have local tracking branches for, on which machines.\n>  I'll end up just doing `git checkout $random-branch`, thinking I'm on\n> one of the machines where I've already setup the local branch, and\n> find it quite handy that Git _does_ DWIM.\n\nI see. But would it be so terrible to have to type \"git checkout -t\norigin/branch\" instead?\n\nAlso, isn't this more like \"foretell what I really want\" rather\nthan \"do what it means\"? Who would guess that \"git checkout\n$branch\" means \"create $branch tracking <random-remote>/$branch\"?\n\nAnd this is exactly _why_ it can be marginally useful if the\nforetelling is correct, but all the more confusing if it's not.\n"},{"id":"143093","messageId":"AANLkTinjp8fprN0KkY-z8VuTXM4A1_VXPGVaUAs46qjX@mail.gmail.com","threadId":"24017","inReplyTo":"20100606173233.GA11041@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-06-06T17:34:11Z","receivedAt":"2010-06-06T17:34:11Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Jun 6, 2010 at 19:32, Clemens Buchacher <drizzd@aon.at> wrote:\n> Also, isn't this more like \"foretell what I really want\" rather\n> than \"do what it means\"? Who would guess that \"git checkout\n> $branch\" means \"create $branch tracking <random-remote>/$branch\"?\n\nNote that DWIM stands for \"Do What I Mean\", not \"Do What It Means\".\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"143098","messageId":"201006062034.19471.johan@herland.net","threadId":"24017","inReplyTo":"20100606165554.GB10104@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2010-06-06T18:34:19Z","receivedAt":"2010-06-06T18:34:19Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Sunday 06 June 2010, Clemens Buchacher wrote:\n> On Sun, Jun 06, 2010 at 12:18:05PM -0400, Jeff King wrote:\n> > Moreover, the burden for arguing against it is a little higher. It is\n> > no longer \"I think this is a bad idea\" but \"I think this is a bad\n> > idea, and it is so bad that it is worth changing behavior that users\n> > may have become accustomed to\".\n> \n> I argue that people are more likely to be surprised and confused by\n> this feature rather than being accustomed to it already. I am also\n> waiting to hear from someone who actively uses this feature.\n\nI use this feature all the time, and find it very nice and useful.\n\nMoreover, at $DAYJOB, we have a lot of Git newbies (many of them still can't \nproperly juggle remote branches. remote-tracking branches, and local \nbranches with tracking info). They mostly work on local topic branches that \ntracks corresponding shared topic branches in a central repo. For them, \nswitching to one of these topic branches is simply a matter of 'git checkout \n<branchname>', without having to care (or know) if you've already created \nthe local branch or not. In this case, Git really does the Right Thing (tm) \nfor us.\n\nIn several cases this DWIMmery has prompted people to update from an old Git \nversion, just to get this feature.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"143109","messageId":"AANLkTilvHl-8eA6CbEDs4ty3h0h670L_enGsXunHxaPE@mail.gmail.com","threadId":"24017","inReplyTo":"20100606173233.GA11041@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2010-06-06T21:26:08Z","receivedAt":"2010-06-06T21:26:08Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Sun, Jun 6, 2010 at 10:32, Clemens Buchacher <drizzd@aon.at> wrote:\n> On Sun, Jun 06, 2010 at 09:59:08AM -0700, Jacob Helwig wrote:\n>> On Sun, Jun 6, 2010 at 09:55, Clemens Buchacher <drizzd@aon.at> wrote:\n>> >\n>> > I argue that people are more likely to be surprised and confused by\n>> > this feature rather than being accustomed to it already. I am also\n>> > waiting to hear from someone who actively uses this feature.\n>> >\n>>\n>> I am someone that \"actively\" uses this feature.  I will often have\n>> repositories that I use on multiple machines, and will forget which\n>> remote branches I have local tracking branches for, on which machines.\n>>  I'll end up just doing `git checkout $random-branch`, thinking I'm on\n>> one of the machines where I've already setup the local branch, and\n>> find it quite handy that Git _does_ DWIM.\n>\n> I see. But would it be so terrible to have to type \"git checkout -t\n> origin/branch\" instead?\n>\n\nGiven that `git checkout branch` already exists & works: Yes.\n\nYou're talking about removing a feature, so (as already pointed out)\nthere's a fairly high burden of proof to show that it's actually a\nmis-feature, that is so dangerous/confusing that it _needs_ to be\nremoved.\n\n> Also, isn't this more like \"foretell what I really want\" rather\n> than \"do what it means\"? Who would guess that \"git checkout\n> $branch\" means \"create $branch tracking <random-remote>/$branch\"?\n>\n\nThis is very much \"fortell what I really want\", which is exactly what\nDWIM (Do What I Mean) means (as Sverre already pointed out).  I'm not\nguessing that `git checkout $branch` means `git branch -t $branch\norigin/$branch && git checkout $branch`; I'm assuming that `git branch\n-t $branch origin/$branch` was already done at some point in the past,\nand Git is adding that bit in for me, which is what _I_ really meant\nto do.\n\n> And this is exactly _why_ it can be marginally useful if the\n> foretelling is correct, but all the more confusing if it's not.\n>\n\nOther than \"unexpected success\", how is the DWIM behavior confusing,\ngiven that it says exactly what it's doing when the DWIM behavior is\ninvoked?  I'm still not clear what the confusion you're referring to\nis on this one.\n"},{"id":"143142","messageId":"buobpbnz6mh.fsf@dhlpc061.dev.necel.com","threadId":"24017","inReplyTo":"20100606164642.GA10104@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2010-06-07T06:41:58Z","receivedAt":"2010-06-07T06:41:58Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n> The suggestion above would be perfect. It is an easy and obvious\n> solution, and the user is even educated about their mistake.\n\nOf course, having been educated as to what's going on, the user would\nthen be annoyed that they had to type all those boilerplate args when\ngit clearly knew what they wanted to do... and that would be the case\nevery time from then on...\n\nI think this DWIM is actually pretty convenient, and very often does\nreflect what the user intuitively is trying to do when giving such args.\n\nGiven that git _does_ tell you what it's doing, and that it's easy\nenough to delete the new branch if it wasn't really wanted, it seems\npretty harmless as well.  A campaign to delete this feature seems kind\nof silly...\n\n-Miles\n\n-- \nI'm beginning to think that life is just one long Yoko Ono album; no rhyme\nor reason, just a lot of incoherent shrieks and then it's over.  --Ian Wolff\n"},{"id":"143145","messageId":"4C0CA577.6080103@gnu.org","threadId":"24017","inReplyTo":"20100606164642.GA10104@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2010-06-07T07:53:27Z","receivedAt":"2010-06-07T07:53:27Z","isPatch":false,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 06/06/2010 06:46 PM, Clemens Buchacher wrote:\n> That is exactly my point. Trying to read the user's mind is not a\n> solution to this problem. The user does not even know what they are\n> doing and will inevitably end up even more confused.\n\nMaybe you just want branch.autosetupmerge = false?\n\nPaolo\n"},{"id":"143176","messageId":"20100607182956.GA17343@localhost","threadId":"24017","inReplyTo":"AANLkTilvHl-8eA6CbEDs4ty3h0h670L_enGsXunHxaPE@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-07T18:29:56Z","receivedAt":"2010-06-07T18:29:56Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sun, Jun 06, 2010 at 02:26:08PM -0700, Jacob Helwig wrote:\n>\n> > And this is exactly _why_ it can be marginally useful if the\n> > foretelling is correct, but all the more confusing if it's not.\n> >\n> \n> Other than \"unexpected success\", how is the DWIM behavior confusing,\n> given that it says exactly what it's doing when the DWIM behavior is\n> invoked?  I'm still not clear what the confusion you're referring to\n> is on this one.\n\nI am telling git to checkout a branch. Instead it creates a branch.\nThat is what is confusing to me. Until I found the commit that\nintroduced it, I was sure it must be a bug.\n"},{"id":"143178","messageId":"20100607185439.GB17343@localhost","threadId":"24017","inReplyTo":"buobpbnz6mh.fsf@dhlpc061.dev.necel.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-07T18:54:39Z","receivedAt":"2010-06-07T18:54:39Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Mon, Jun 07, 2010 at 03:41:58PM +0900, Miles Bader wrote:\n> Clemens Buchacher <drizzd@aon.at> writes:\n> > The suggestion above would be perfect. It is an easy and obvious\n> > solution, and the user is even educated about their mistake.\n> \n> Of course, having been educated as to what's going on, the user would\n> then be annoyed that they had to type all those boilerplate args when\n> git clearly knew what they wanted to do... and that would be the case\n> every time from then on...\n\nWhy should the user make the same mistake over and over again?\n\n> I think this DWIM is actually pretty convenient, and very often does\n> reflect what the user intuitively is trying to do when giving such args.\n> \n> Given that git _does_ tell you what it's doing, and that it's easy\n> enough to delete the new branch if it wasn't really wanted, it seems\n> pretty harmless as well.  A campaign to delete this feature seems kind\n> of silly...\n\nIt may be harmless to users who know what's going on. I can\ncertainly deal with this feature, whether it's there or not.\n\nBut this is supposedly a feature which helps users who type \"git\ncheckout <branch>\" by mistake, when they really wanted to do \"git\ncheckout -t <remote>/<branch>\". I am certain that most new users\nwho make this mistake will not understand what's going on, even if\nthey read the output.\n\nI believe that it's because of things like this that many users\nstill consider git to be complicated and hard to use. That's what\nreally bothers me.\n\nAnd it makes me sad that you think it silly to even talk about it.\nEven if the feature does not end up getting removed I still hope\nthat we will exercise more caution in the future and try to solve\nthe real problem--which appears to be remote branch\nhandling--rather than introducing more strange behavior.\n\nRegards,\nClemens\n"},{"id":"143180","messageId":"vpqzkz6fy9m.fsf@bauges.imag.fr","threadId":"24017","inReplyTo":"20100607185439.GB17343@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-07T19:17:25Z","receivedAt":"2010-06-07T19:17:25Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n> But this is supposedly a feature which helps users who type \"git\n> checkout <branch>\" by mistake, when they really wanted to do \"git\n> checkout -t <remote>/<branch>\".\n\nNot sure what's the argument here, but aren't the two commands\nequivalent? Do you prefer the second syntax \"git checkout -t\n<remote>/<branch>\"? It's already a DWIM for \"git checkout -b <branch>\n-t <remote>/<branch>\", and I find this one far more confusing:\n\ngit checkout    <remote>/<branch> => detaches HEAD\ngit checkout -t <remote>/<branch> => creates a local branch automatically\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"143181","messageId":"20100607193226.GA19789@localhost","threadId":"24017","inReplyTo":"vpqzkz6fy9m.fsf@bauges.imag.fr","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-07T19:32:26Z","receivedAt":"2010-06-07T19:32:26Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Mon, Jun 07, 2010 at 09:17:25PM +0200, Matthieu Moy wrote:\n> Clemens Buchacher <drizzd@aon.at> writes:\n> \n> > But this is supposedly a feature which helps users who type \"git\n> > checkout <branch>\" by mistake, when they really wanted to do \"git\n> > checkout -t <remote>/<branch>\".\n> \n> Not sure what's the argument here, but aren't the two commands\n> equivalent? Do you prefer the second syntax \"git checkout -t\n> <remote>/<branch>\"? It's already a DWIM for \"git checkout -b <branch>\n> -t <remote>/<branch>\", and I find this one far more confusing:\n> \n> git checkout    <remote>/<branch> => detaches HEAD\n> git checkout -t <remote>/<branch> => creates a local branch automatically\n\nThe intent with -t is clear. It is used only when you create a new\nbranch. Also, you specify the remote branch you're going to create\na new branch from.\n\n\"git checkout <branch>\", on the other hand, will create a branch\nbased on a remote branch, even though you neither asked for a new\nbranch, nor did you specify any remote at all.\n"},{"id":"143183","messageId":"80631uboye.fsf@tiny.isode.net","threadId":"24017","inReplyTo":"20100607193226.GA19789@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2010-06-07T19:52:09Z","receivedAt":"2010-06-07T19:52:09Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n[...]\n\n> \"git checkout <branch>\", on the other hand, will create a branch\n> based on a remote branch, even though you neither asked for a new\n> branch, nor did you specify any remote at all.\n\nProvided such a branch doesn't already exist and that only one remote\nmatches.  I agree it's magic (and understand why people might not like\nit) but personally I find it convenient.\n\nPossibly (because it hides the distinction between local and remote\nbranches a little) it would be better opt-in than the default, but I\nthink a reasonable case could be made in both directions.\n\n[...]\n"},{"id":"143185","messageId":"20100607221134.002ae81a@jk.gs","threadId":"24017","inReplyTo":"20100607182956.GA17343@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Jan Krüger","fromEmail":"jk@jk.gs","sentAt":"2010-06-07T20:11:34Z","receivedAt":"2010-06-07T20:11:34Z","isPatch":false,"sender":{"key":"jk@jk.gs","avatar":"https://avatars.githubusercontent.com/u/1774?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> wrote:\n\n> > Other than \"unexpected success\", how is the DWIM behavior confusing,\n> > given that it says exactly what it's doing when the DWIM behavior is\n> > invoked?  I'm still not clear what the confusion you're referring to\n> > is on this one.\n> \n> I am telling git to checkout a branch. Instead it creates a branch.\n> That is what is confusing to me. Until I found the commit that\n> introduced it, I was sure it must be a bug.\n\nI usually see the opposite kind of confusion on #git: someone cloned a\nrepository and wants to work on one of the branches. After all, we tell\neveryone that clone copies all the history.\n\nSo they type \"git checkout <that branch>\"... and they get a weird\nerror (what's a pathspec, anyway?). OMGWTFBBQ! Not knowing what's going\non, they drop by in #git and hear they need to type something much less\nstraightforward than \"git checkout <that branch>\". They don't really\nknow why, so they probably assume it's because git is just so damn\ncomplicated and overengineered.\n\nI have yet to see any newish users complain about the new syntax, by the\nway. You don't qualify, sorry. ;)\n"},{"id":"143191","messageId":"20100607211253.GA21738@localhost","threadId":"24017","inReplyTo":"20100607221134.002ae81a@jk.gs","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-07T21:12:53Z","receivedAt":"2010-06-07T21:12:53Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Mon, Jun 07, 2010 at 10:11:34PM +0200, Jan Krüger wrote:\n> Clemens Buchacher <drizzd@aon.at> wrote:\n> \n> > I am telling git to checkout a branch. Instead it creates a branch.\n> > That is what is confusing to me. Until I found the commit that\n> > introduced it, I was sure it must be a bug.\n> \n> I usually see the opposite kind of confusion on #git: someone cloned a\n> repository and wants to work on one of the branches. After all, we tell\n> everyone that clone copies all the history.\n> \n> So they type \"git checkout <that branch>\"... and they get a weird\n> error (what's a pathspec, anyway?).\n\nI agree, that's a less than perfect error message. So let's improve\nit. What about \"unknown branch or file name\"? Possibly also output\nthe most common synopsis?\n\n> OMGWTFBBQ! Not knowing what's going\n> on, they drop by in #git and hear they need to type something much less\n> straightforward than \"git checkout <that branch>\". They don't really\n> know why, so they probably assume it's because git is just so damn\n> complicated and overengineered.\n\nWell, but that's how it is. If we want more \"global\" branches, then\nwe will have to think about how to achieve that. But hiding what we\nreally have is not going to make it easier to understand.\n\n> I have yet to see any newish users complain about the new syntax, by the\n> way. You don't qualify, sorry. ;)\n\nI started this entire thread only because someone on #git was\nconfused by it.\n"},{"id":"143198","messageId":"AANLkTilccgKxO7YCTJYc5rTzhov5Tku2z8jSfWU_B4ui@mail.gmail.com","threadId":"24017","inReplyTo":"20100607185439.GB17343@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2010-06-08T00:25:07Z","receivedAt":"2010-06-08T00:25:07Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"On Tue, Jun 8, 2010 at 3:54 AM, Clemens Buchacher <drizzd@aon.at> wrote:\n>> then be annoyed that they had to type all those boilerplate args when\n>> git clearly knew what they wanted to do... and that would be the case\n>> every time from then on...\n>\n> Why should the user make the same mistake over and over again?\n\nWhat I mean is that every time thereafter that they want that\nfunctionality (making a remote branch local), they'll have to type the\n\"long form\".\n\n> And it makes me sad that you think it silly to even talk about it.\n\nI don't think it's silly to note your concern, I think it's silly to\nput a fair amount of effort into a campaign for its removal, which is\nwhat you are doing.  If new points can be made, fair enough, but so\nfar it seems mainly a lot of back and forth stating the same things\nover and over.\n\n> I believe that it's because of things like this that many users\n> still consider git to be complicated and hard to use. That's what\n> really bothers me.\n\nWhy do you think that?  I mean, you could be right, but it's certainly\nconceivable that this feature causes users to consider git _simpler_\nto use, because it lets them think about local branches only.\n\n-Miles\n\n-- \nDo not taunt Happy Fun Ball.\n"},{"id":"143209","messageId":"20100608072958.GA24302@localhost","threadId":"24017","inReplyTo":"AANLkTilccgKxO7YCTJYc5rTzhov5Tku2z8jSfWU_B4ui@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-08T07:29:58Z","receivedAt":"2010-06-08T07:29:58Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Tue, Jun 08, 2010 at 09:25:07AM +0900, Miles Bader wrote:\n>\n> > And it makes me sad that you think it silly to even talk about it.\n> \n> I don't think it's silly to note your concern, I think it's silly to\n> put a fair amount of effort into a campaign for its removal, which is\n> what you are doing.  If new points can be made, fair enough, but so\n> far it seems mainly a lot of back and forth stating the same things\n> over and over.\n\nSince I started this, I feel responsible for responding to people's\ncomments. I do not think I am doing anything wrong. So please\nforgive me for responding to you as well, even if you think it\nsilly of me.\n\n> > I believe that it's because of things like this that many users\n> > still consider git to be complicated and hard to use. That's what\n> > really bothers me.\n> \n> Why do you think that?  I mean, you could be right, but it's certainly\n> conceivable that this feature causes users to consider git _simpler_\n> to use, because it lets them think about local branches only.\n\nThinking about local branches only is wrong.\n\nLet's assume the user \"just wants to check out branch X.\" Such a\nuse case has been mentioned previously in this thread. So they say\n\"git checkout X\", and voila, they get what they wanted.\n\nIt did what they meant it to do. Everybody is happy. But not for\nlong.\n\nBecause the next time they \"just want to check out branch X,\" they\nwill remember, it's time for \"git checkout X.\" But what's this?\nThis is not what they wanted. It does not have the latest changes\non branch X! Didn't they do the same thing they did last time?\n\nNo they did not, because last time they _created a branch_.\nEventually, if they are lucky, they will learn in #git that they\nwere supposed to \"git merge <remote>/X.\" And they will think \"WTF?\nWhy do I have to _merge_? And what's this business about remotes?\nWhy is git is so complicated?\"\n\nSo all we did was delay the user's confusion, and make it worse,\nbecause now the mind model of \"local branches only\" they have\ndeveloped, is broken.\n\nGit uses slightly different semantics than other VCSs, especially\nwhen it comes to branches. And that often causes users to become\nconfused. But I happen to think that git's branch model is\nsuperior, and easy to understand once you unlearn what you know\nfrom other VCSs.\n\nBut if we try to hide that fact and imitate other VCSs on the\nsurface, that will only make it harder to learn.\n\nRegards,\nClemens\n"},{"id":"143210","messageId":"AANLkTimOenmDE53LZJY2yVNkMh7-6PS3yBiaprWC_Po6@mail.gmail.com","threadId":"24017","inReplyTo":"20100608072958.GA24302@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2010-06-08T07:47:07Z","receivedAt":"2010-06-08T07:47:07Z","isPatch":false,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"On 8 June 2010 09:29, Clemens Buchacher <drizzd@aon.at> wrote:\n> No they did not, because last time they _created a branch_.\n> Eventually, if they are lucky, they will learn in #git that they\n> were supposed to \"git merge <remote>/X.\" And they will think \"WTF?\n> Why do I have to _merge_? And what's this business about remotes?\n> Why is git is so complicated?\"\n\nI'm confused. Wont they actually be told:\n\n  git checkout $foo\n  git pull\n  git push\n\nWhy would they need to do a git merge $remote/X?\n\nThe only reason I can think of is that they are doing cross branch\nmerges, but then they are by default beyond the novice user and can be\nexpected to know various things, and to have read the docs.\n\nYves\n\n\n\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"},{"id":"143212","messageId":"AANLkTiljpUDEYKar1ni-lvTMvGEKvM5o7cb95qn798Ok@mail.gmail.com","threadId":"24017","inReplyTo":"20100608072958.GA24302@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2010-06-08T07:52:40Z","receivedAt":"2010-06-08T07:52:40Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"On Tue, Jun 8, 2010 at 4:29 PM, Clemens Buchacher <drizzd@aon.at> wrote:\n> Eventually, if they are lucky, they will learn in #git that they\n> were supposed to \"git merge <remote>/X.\"\n\nThey don't have to do that, they just have to do \"git pull\".  This\nconcept -- that to get the latest changes, one pulls -- is something\npeople learn very early.\n\nSo, in fact it seems quite natural -- you switch to a local branch\nwith \"git co branch\", and then if git tells you it's not up-to-date,\nyou \"git pull\".  All nice and smooth and simple and standard.  The\nDWIM simply makes the first time less clumsy, and while everybody\nbenefits, beginners probably benefit a bit more.\n\n-Miles\n\n-- \nDo not taunt Happy Fun Ball.\n"},{"id":"143211","messageId":"20100608075241.GA3166@coredump.intra.peff.net","threadId":"24017","inReplyTo":"20100608072958.GA24302@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-06-08T07:52:42Z","receivedAt":"2010-06-08T07:52:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jun 08, 2010 at 09:29:58AM +0200, Clemens Buchacher wrote:\n\n> Let's assume the user \"just wants to check out branch X.\" Such a\n> use case has been mentioned previously in this thread. So they say\n> \"git checkout X\", and voila, they get what they wanted.\n> \n> It did what they meant it to do. Everybody is happy. But not for\n> long.\n> \n> Because the next time they \"just want to check out branch X,\" they\n> will remember, it's time for \"git checkout X.\" But what's this?\n> This is not what they wanted. It does not have the latest changes\n> on branch X! Didn't they do the same thing they did last time?\n> \n> No they did not, because last time they _created a branch_.\n> Eventually, if they are lucky, they will learn in #git that they\n> were supposed to \"git merge <remote>/X.\" And they will think \"WTF?\n> Why do I have to _merge_? And what's this business about remotes?\n> Why is git is so complicated?\"\n\nFWIW, I made this same complaint at the GitTogether, and the response I\ngot is that git does help the user along through the second \"checkout\".\nYou get something like:\n\n  $ git checkout foo\n  Branch private set up to track remote branch foo from origin.\n  Switched to a new branch 'foo'\n\n  ... time passes ...\n\n  $ git checkout foo\n  Switched to branch 'foo'\n  Your branch is behind 'origin/foo' by 5 commits, and can be fast-forwarded.\n\nNow you can certainly argue that a clueless user won't know what to do\nwith those messages, but it is not entirely true that git leaves them\nwithout any advice. Perhaps we could lessen the \"wtf\" moment in your\nexample above by making that advice better.\n\n-Peff\n"},{"id":"143213","messageId":"4C0DFA55.8070800@drmicha.warpmail.net","threadId":"24017","inReplyTo":"20100607193226.GA19789@localhost","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-06-08T08:07:49Z","receivedAt":"2010-06-08T08:07:49Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Clemens Buchacher venit, vidit, dixit 07.06.2010 21:32:\n> On Mon, Jun 07, 2010 at 09:17:25PM +0200, Matthieu Moy wrote:\n>> Clemens Buchacher <drizzd@aon.at> writes:\n>>\n>>> But this is supposedly a feature which helps users who type \"git\n>>> checkout <branch>\" by mistake, when they really wanted to do \"git\n>>> checkout -t <remote>/<branch>\".\n>>\n>> Not sure what's the argument here, but aren't the two commands\n>> equivalent? Do you prefer the second syntax \"git checkout -t\n>> <remote>/<branch>\"? It's already a DWIM for \"git checkout -b <branch>\n>> -t <remote>/<branch>\", and I find this one far more confusing:\n>>\n>> git checkout    <remote>/<branch> => detaches HEAD\n>> git checkout -t <remote>/<branch> => creates a local branch automatically\n> \n> The intent with -t is clear. It is used only when you create a new\n> branch. Also, you specify the remote branch you're going to create\n> a new branch from.\n> \n> \"git checkout <branch>\", on the other hand, will create a branch\n> based on a remote branch, even though you neither asked for a new\n> branch, nor did you specify any remote at all.\n\nYou're making a very important point here:\n\nThe existing DWIMery executes *different commands* depending on the\ncircumstances (<branch> existing or not). \"checkout\" and \"checkout\n-t/-b\" really are different commands.\n\nFor me, DWIMery is OK in these cases:\n\n- completing refs (<name> may be refs/heads/<name> or refs/tags/<name> etc.)\n\n- Adding options without which the other options don't make sense\n(independent of the circumstances), such adding \"-b\" for \"-t\", or, even\ndoing the DWIMery above since \"--track\" is requested explicitly.\n\nChanging the command (mode) is something fundamentally different.\n\n[In this specific case, it also keeps the user from learning what's\ngoing on, but that's a different issue.]\n\nBut I'm afraid it's too late.\n\nMichael\n"},{"id":"143216","messageId":"AANLkTinCq1lzD8_RTQVKOcEkDh_Yw41WXpYQsJVgkJRn@mail.gmail.com","threadId":"24017","inReplyTo":"4C0DFA55.8070800@drmicha.warpmail.net","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2010-06-08T08:18:59Z","receivedAt":"2010-06-08T08:18:59Z","isPatch":false,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"On 8 June 2010 10:07, Michael J Gruber <git@drmicha.warpmail.net> wrote:\n> Clemens Buchacher venit, vidit, dixit 07.06.2010 21:32:\n>> On Mon, Jun 07, 2010 at 09:17:25PM +0200, Matthieu Moy wrote:\n>>> Clemens Buchacher <drizzd@aon.at> writes:\n>>>\n>>>> But this is supposedly a feature which helps users who type \"git\n>>>> checkout <branch>\" by mistake, when they really wanted to do \"git\n>>>> checkout -t <remote>/<branch>\".\n>>>\n>>> Not sure what's the argument here, but aren't the two commands\n>>> equivalent? Do you prefer the second syntax \"git checkout -t\n>>> <remote>/<branch>\"? It's already a DWIM for \"git checkout -b <branch>\n>>> -t <remote>/<branch>\", and I find this one far more confusing:\n>>>\n>>> git checkout    <remote>/<branch> => detaches HEAD\n>>> git checkout -t <remote>/<branch> => creates a local branch automatically\n>>\n>> The intent with -t is clear. It is used only when you create a new\n>> branch. Also, you specify the remote branch you're going to create\n>> a new branch from.\n>>\n>> \"git checkout <branch>\", on the other hand, will create a branch\n>> based on a remote branch, even though you neither asked for a new\n>> branch, nor did you specify any remote at all.\n>\n> You're making a very important point here:\n>\n> The existing DWIMery executes *different commands* depending on the\n> circumstances (<branch> existing or not). \"checkout\" and \"checkout\n> -t/-b\" really are different commands.\n\n\"checkout a branch\" is the command. The rest is just bookkeeping.\n\nYves\n\n\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"},{"id":"143218","messageId":"4C0E0131.9030701@drmicha.warpmail.net","threadId":"24017","inReplyTo":"AANLkTinCq1lzD8_RTQVKOcEkDh_Yw41WXpYQsJVgkJRn@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-06-08T08:37:05Z","receivedAt":"2010-06-08T08:37:05Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"demerphq venit, vidit, dixit 08.06.2010 10:18:\n> On 8 June 2010 10:07, Michael J Gruber <git@drmicha.warpmail.net> wrote:\n>> Clemens Buchacher venit, vidit, dixit 07.06.2010 21:32:\n>>> On Mon, Jun 07, 2010 at 09:17:25PM +0200, Matthieu Moy wrote:\n>>>> Clemens Buchacher <drizzd@aon.at> writes:\n>>>>\n>>>>> But this is supposedly a feature which helps users who type \"git\n>>>>> checkout <branch>\" by mistake, when they really wanted to do \"git\n>>>>> checkout -t <remote>/<branch>\".\n>>>>\n>>>> Not sure what's the argument here, but aren't the two commands\n>>>> equivalent? Do you prefer the second syntax \"git checkout -t\n>>>> <remote>/<branch>\"? It's already a DWIM for \"git checkout -b <branch>\n>>>> -t <remote>/<branch>\", and I find this one far more confusing:\n>>>>\n>>>> git checkout    <remote>/<branch> => detaches HEAD\n>>>> git checkout -t <remote>/<branch> => creates a local branch automatically\n>>>\n>>> The intent with -t is clear. It is used only when you create a new\n>>> branch. Also, you specify the remote branch you're going to create\n>>> a new branch from.\n>>>\n>>> \"git checkout <branch>\", on the other hand, will create a branch\n>>> based on a remote branch, even though you neither asked for a new\n>>> branch, nor did you specify any remote at all.\n>>\n>> You're making a very important point here:\n>>\n>> The existing DWIMery executes *different commands* depending on the\n>> circumstances (<branch> existing or not). \"checkout\" and \"checkout\n>> -t/-b\" really are different commands.\n> \n> \"checkout a branch\" is the command. The rest is just bookkeeping.\n\nI'm sorry but that is just plain silly.\n\nWe have several \"commands\" which do very different things depending on\noptions, i.e. comprise different commands/command modes - which is why I\nused the phrase command (mode) in the part you chose to leave out.\n\nOne mode is checking out an existing branch.\n\nOne mode is creating a new branch and checking it out, i.e. doing a \"git\nbranch\" followed by a \"git checkout\" proper.\n\nCurrent DWIMery switches from the first to the second depending on your\nexisting branches. The only reason this could sneak in is the fact that\nit is non-destructive, just (over-) eagerly constructive.\n\nMichael\n"},{"id":"143229","messageId":"vpqaar5r7zh.fsf@bauges.imag.fr","threadId":"24017","inReplyTo":"AANLkTimOenmDE53LZJY2yVNkMh7-6PS3yBiaprWC_Po6@mail.gmail.com","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-08T13:04:18Z","receivedAt":"2010-06-08T13:04:18Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"demerphq <demerphq@gmail.com> writes:\n\n> On 8 June 2010 09:29, Clemens Buchacher <drizzd@aon.at> wrote:\n>> No they did not, because last time they _created a branch_.\n>> Eventually, if they are lucky, they will learn in #git that they\n>> were supposed to \"git merge <remote>/X.\" And they will think \"WTF?\n>> Why do I have to _merge_? And what's this business about remotes?\n>> Why is git is so complicated?\"\n>\n> I'm confused. Wont they actually be told:\n>\n>   git checkout $foo\n>   git pull\n>   git push\n\nRight. Just like they learnt clone/push/pull before knowing about\nremote and tracking branches, because clone did the magic for them\nwhen creating the repo.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"143260","messageId":"20100608181353.GA3083@localhost","threadId":"24017","inReplyTo":"20100608075241.GA3166@coredump.intra.peff.net","subject":"Re: DWIM \"git checkout frotz\" to \"git checkout -b frotz origin/frotz\"","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-08T18:13:53Z","receivedAt":"2010-06-08T18:13:53Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Tue, Jun 08, 2010 at 03:52:42AM -0400, Jeff King wrote:\n>\n>   $ git checkout foo\n>   Branch private set up to track remote branch foo from origin.\n>   Switched to a new branch 'foo'\n> \n>   ... time passes ...\n> \n>   $ git checkout foo\n>   Switched to branch 'foo'\n>   Your branch is behind 'origin/foo' by 5 commits, and can be fast-forwarded.\n\nI see. That really is somewhat reassuring. I still do not like it,\nbut considering the fact that I could not come up with a scenario\nworse than that, I suppose the feature is not as bad as I made it\nout to be.\n\nThanks all for discussing it with me anyways.\n\nRegards,\nClemens\n"}]}