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

Re: [PATCH] checkout --track: make up a sensible branch name if '-b' was omitted

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 11, 2008, 11:01 UTC
Message-ID
<alpine.DEB.1.00.0808111256260.24820@pacific.mpi-cbg.de.mpi-cbg.de>
In-Reply-To
<7vsktd51wg.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 9 Aug 2008, Junio C Hamano wrote:
Show 22 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Sat, 9 Aug 2008, Junio C Hamano wrote:
> > ...
> >> (2) If you work with somebody else, you might not want to have the name
> >>     mapping to be "s|^[^/]*/||" (i.e. drop "origin/"):
> >> 
> >>     $ git remote add -f jeff $url_to_his_repository
> >>     $ git checkout -b [--track] jeff-next jeff/next
> >>     $ git checkout -b [--track] origin-next origin/next
> >
> > As I said, I think you must not allow switching around the options -b 
> > and --track.
> 
> Oh, that was a typo.  "git checkout [--track] -b" was what I meant, but 
> the point was that with your patch "git checkout --track jeff/next" and 
> "git checkout --track origin/next" would create 'next' branch which will 
> not be useful for people who work with more than one repository.
> 
> Yes, you can of course explicitly name what you want to create with -b, 
> but that argument goes directly against the "usability enhancement" 
> theme of your patch.
Not necessarily:

$ git checkout --track jeff/next Switched to a new branch "next"

[do a lot of work, even on that 'next' branch]
[weeks, months or centuries later, decide to do something on origin/next]

$ git checkout --track origin/next fatal: A branch named 'next' already exists.

[Ah! Slap your head, remembering that 'next' tracks jeff's 'next']
$ git branch -m next jeff-next
Branch: next renamed to jeff-next
$ git checkout --track -b origin-next origin/next

Concluding, I do not see how the DWIMing of the normal case impacts the non-normal case negatively.

Don't get me wrong. I do not need that patch in git.git desperately. But if it is rejected, I want it to be rejected for reasons I understand.

Ciao, Dscho

Previous: Johannes SchindelinNext: Junio C Hamano
Message 8 of 10 in “checkout --track: make up a sensible branch name if '-b' was omitted”
  1. checkout --track: make up a sensible branch name if '-b' was omittedJohannes Schindelin, Aug 9, 2008
  2. Junio C HamanoAug 9, 2008
  3. Junio C HamanoAug 9, 2008
  4. Johannes SchindelinAug 9, 2008
  5. Junio C HamanoAug 9, 2008
  6. Pieter de BieAug 9, 2008
  7. Johannes SchindelinAug 10, 2008
  8. Johannes SchindelinAug 11, 2008
  9. Junio C HamanoAug 11, 2008
  10. TarmiganAug 9, 2008

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.