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 10, 2008, 23:02 UTC
Message-ID
<alpine.DEB.1.00.0808110058360.24820@pacific.mpi-cbg.de.mpi-cbg.de>
In-Reply-To
<A6E466C6-C3B5-40EB-940C-516CF4D02ADF@frim.nl>
Hi,
On Sat, 9 Aug 2008, Pieter de Bie wrote:
> Changing the behaviour to mean "git checkout -b origin/master master" 
> will change the meaning, but who uses -b with an existing remote branch 
> anyway?

FWIW I am totally opposed to this kind of reasoning. I consider it sloppy to make assumptions that might or might not be true, and to force a change that might be convenient to you, but is likely to hurt others.

Besides, your suggestion completely breaks consistency. If somebody asks to name a new branch "origin/master" (and "-b origin/master" is _just_ _that_), then it is not Git's job to fix the user's mistake. Just like it is not Git's job to fix when somebody said "git commit", but meant "git push".

After all, I might _want_ to create a local branch "origin/master", and you would just break the valid assumption that "-b origin/master" would do that for me.

Hth, Dscho

Previous: Pieter de BieNext: Johannes Schindelin
Message 7 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.