git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH v3] checkout: eliminate unnecessary merge for trivial checkout

From
Ben Peart <ben.peart@microsoft.com>
Date
Sep 21, 2016, 18:32 UTC
Message-ID
<BL2PR03MB323ADC371E49EFD1CBBC566F4F60@BL2PR03MB323.namprd03.prod.outlook.com>
In-Reply-To
<xmqqr38fg6tk.fsf@gitster.mtv.corp.google.com>
I understand the reluctance to change the existing behavior of the "git checkout -b <new-name>" command.
I see this as a tradeoff between taking advantage of the muscle memory for the existing command and coming up with a new shortcut command and training people to use it instead.
The fact that all the use cases we've observed and all the git test cases actually produce the same results but significantly faster with that change in behavior made me hope we could redefine the command to take advantage of the muscle memory.
That said, you're much more on the frontline of receiving negative feedback about doing that than I am. :)  How would you like to proceed?
Ben
-----Original Message-----
From: Junio C Hamano [mailto:gitster@pobox.com] 
Sent: Monday, September 19, 2016 1:04 PM
To: Ben Peart <peartben@gmail.com>
Cc: pclouds@gmail.com; Ben Peart <Ben.Peart@microsoft.com>; git@vger.kernel.org
Subject: Re: [PATCH v3] checkout: eliminate unnecessary merge for trivial checkout
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
>> "git checkout -b foo" (without -f -m or <start_point>) is defined in 
>> the manual as being a shortcut for/equivalent to:
>>  
>>         (1a) "git branch foo"
>>         (1b) "git checkout foo"
>>  
>> However, it has been our experience in our observed use cases and all 
>> the existing git tests, that it can be treated as equivalent to:
>>  
>>         (2a) "git branch foo"
>>         (2b) "git symbolic-ref HEAD refs/heads/foo"
>> ...
>
> I am still not sure if I like the change of what "checkout -b" is this 
> late in the game, though.
Having said all that.

I do see the merit of having a shorthand way to invoke your 2 above. It is just that I am not convinced that it is the best way to achieve that goal to redefine what "git checkout -b <new-name>" (no other parameters) does.

Previous: Junio C HamanoNext: Philip Oakley
Message 8 of 11 in “checkout: eliminate unnecessary merge for trivial checkout”
  1. checkout: eliminate unnecessary merge for trivial checkoutBen Peart, Sep 13, 2016
  2. Junio C HamanoSep 13, 2016
  3. Oleg TaranenkoSep 14, 2016
  4. Junio C HamanoSep 14, 2016
  5. Ben PeartSep 19, 2016
  6. Junio C HamanoSep 19, 2016
  7. Junio C HamanoSep 19, 2016
  8. Ben PeartSep 21, 2016
  9. Philip OakleySep 24, 2016
  10. Junio C HamanoSep 24, 2016
  11. Philip OakleySep 24, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.