{"thread":{"id":"47155","subject":"is there a stylistic preference for a trailing \"--\" on a command?","startedAt":"2017-11-10T13:58:11Z","lastAt":"2017-11-12T01:18:16Z","messageCount":4,"participants":["Robert P. J. Day","Stefan Beller","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"332182","messageId":"alpine.LFD.2.21.1711100855140.3617@DESKTOP-1GPMCEJ","threadId":"47155","inReplyTo":null,"subject":"is there a stylistic preference for a trailing \"--\" on a command?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2017-11-10T13:57:45Z","receivedAt":"2017-11-10T13:58:11Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  just noticed these examples in \"man git-bisect\":\n\nEXAMPLES\n  $ git bisect start HEAD v1.2 --      # HEAD is bad, v1.2 is good\n  ...\n  $ git bisect start HEAD origin --    # HEAD is bad, origin is good\n  ...\n  $ git bisect start HEAD HEAD~10 --   # culprit is among the last 10\n\nis there some rationale or stylistic significance to those trailing\n\"--\" on those commands? i assume they have no effect, just curious as\nto why they're there.\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                        http://crashcourse.ca\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n"},{"id":"332201","messageId":"CAGZ79kavxFA_wBzcSbR8LT4uZGkdv4c07ZMfE4TK0tkooMGg6Q@mail.gmail.com","threadId":"47155","inReplyTo":"alpine.LFD.2.21.1711100855140.3617@DESKTOP-1GPMCEJ","subject":"Re: is there a stylistic preference for a trailing \"--\" on a command?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-11-10T18:12:39Z","receivedAt":"2017-11-10T18:12:46Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Fri, Nov 10, 2017 at 5:57 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:\n>\n>   just noticed these examples in \"man git-bisect\":\n>\n> EXAMPLES\n>   $ git bisect start HEAD v1.2 --      # HEAD is bad, v1.2 is good\n>   ...\n>   $ git bisect start HEAD origin --    # HEAD is bad, origin is good\n>   ...\n>   $ git bisect start HEAD HEAD~10 --   # culprit is among the last 10\n>\n> is there some rationale or stylistic significance to those trailing\n> \"--\" on those commands? i assume they have no effect, just curious as\n> to why they're there.\n\nBy having the -- there, it is clear that the strings are ref specs and not files\nof such a name. (Who would want to store a file named HEAD~10 in their\nrepo?)\n"},{"id":"332293","messageId":"20171111151907.owrbpnn35aepj4ha@sigill.intra.peff.net","threadId":"47155","inReplyTo":"CAGZ79kavxFA_wBzcSbR8LT4uZGkdv4c07ZMfE4TK0tkooMGg6Q@mail.gmail.com","subject":"Re: is there a stylistic preference for a trailing \"--\" on a command?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-11-11T15:39:54Z","receivedAt":"2017-11-11T15:40:01Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 10, 2017 at 10:12:39AM -0800, Stefan Beller wrote:\n\n> On Fri, Nov 10, 2017 at 5:57 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:\n> >\n> >   just noticed these examples in \"man git-bisect\":\n> >\n> > EXAMPLES\n> >   $ git bisect start HEAD v1.2 --      # HEAD is bad, v1.2 is good\n> >   ...\n> >   $ git bisect start HEAD origin --    # HEAD is bad, origin is good\n> >   ...\n> >   $ git bisect start HEAD HEAD~10 --   # culprit is among the last 10\n> >\n> > is there some rationale or stylistic significance to those trailing\n> > \"--\" on those commands? i assume they have no effect, just curious as\n> > to why they're there.\n> \n> By having the -- there, it is clear that the strings are ref specs and not files\n> of such a name. (Who would want to store a file named HEAD~10 in their\n> repo?)\n\nJust to be explicit, that makes it not just clear to the user but clear\nto Git. Without a \"--\" there heuristics that kick in. The first section\nof the \"gitcli\" manpage talks about this, though I don't know that we\nexplicitly document the heuristics anywhere (and I think that is\nintentional -- we promise only to try to do what you meant, and scripts\nthat want exact behavior should use a disambiguating \"--\").\n\n-Peff\n"},{"id":"332303","messageId":"xmqqzi7scn1r.fsf@gitster.mtv.corp.google.com","threadId":"47155","inReplyTo":"20171111151907.owrbpnn35aepj4ha@sigill.intra.peff.net","subject":"Re: is there a stylistic preference for a trailing \"--\" on a command?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-11-12T01:18:08Z","receivedAt":"2017-11-12T01:18:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Nov 10, 2017 at 10:12:39AM -0800, Stefan Beller wrote:\n>\n>> On Fri, Nov 10, 2017 at 5:57 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:\n>> >\n>> >   just noticed these examples in \"man git-bisect\":\n>> >\n>> > EXAMPLES\n>> >   $ git bisect start HEAD v1.2 --      # HEAD is bad, v1.2 is good\n>> >   ...\n>> >   $ git bisect start HEAD origin --    # HEAD is bad, origin is good\n>> >   ...\n>> >   $ git bisect start HEAD HEAD~10 --   # culprit is among the last 10\n>> >\n>> > is there some rationale or stylistic significance to those trailing\n>> > \"--\" on those commands? i assume they have no effect, just curious as\n>> > to why they're there.\n>> \n>> By having the -- there, it is clear that the strings are ref specs and not files\n>> of such a name. (Who would want to store a file named HEAD~10 in their\n>> repo?)\n>\n> Just to be explicit, that makes it not just clear to the user but clear\n> to Git. Without a \"--\" there heuristics that kick in. The first section\n> of the \"gitcli\" manpage talks about this, though I don't know that we\n> explicitly document the heuristics anywhere (and I think that is\n> intentional -- we promise only to try to do what you meant, and scripts\n> that want exact behavior should use a disambiguating \"--\").\n\nIt is funny that your \"Just to be explicit\" reads two ways, and both\nreadings turn out to be correct ;-)\n\nYes, the use of these \"--\" in the examples are just to be explicit\nthat the arguments that come before \"--\" are revisions (and not\npathspecs); doing so prevents Git from complaining of ambiguity even\nwhen a file whose name is HEAD happens to be in your working tree.\n\nAnd it is good that you explicitly teach that these are not to\nclarify for the end users' who read the examples, but to encourage\nusers to get into the habit of using them to make their intention\nclear when writing their scripts.\n\n;-).\n"}]}