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

Re: git checkout -b origin/mybranch origin/mybranch

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 12, 2009, 13:02 UTC
Message-ID
<alpine.DEB.1.00.0903121357320.6335@intel-tinevez-2-302>
In-Reply-To
<43d8ce650903120448x51220ba0k660be7706acba755@mail.gmail.com>
Hi,
On Thu, 12 Mar 2009, John Tapsell wrote:
Show 24 quoted lines
> 2009/3/12 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > On Thu, 12 Mar 2009, John Tapsell wrote:
> >
> >>   One of my collegues did:
> >>
> >> git checkout origin/somebranch
> >>
> >>   git complained that they need to specify the name with -b.  So they did:
> >>
> >> git checkout -b origin/somebranch origin/somebranch
> >
> > Yeah, a pilot error.  It should have been
> >
> >        $ git checkout -t origin/somebranch
> 
> Maybe the error message for "git checkout origin/somebranch"  should
> suggest:  git checkout -t origin/somebranch?
> 
> > I have to wonder, though, why "git checkout origin/somebranch" did not
> > detach your HEAD.
> 
> It did.  But that doesn't affect doing "git checkout -b
> origin/somebranch origin/somebranch"  afterwards.
So did the warning read something like this?
-- snip --
moving to "d36a18dc9cdf1dfce8632e42491b826387aa3230" which isn't a local 
branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
-- snap --
?
If so, why did you not follow the recipe
	$ git checkout -b somebranch
but something like
	$ git checkout -b origin/somebranch origin/somebranch
?

I do not think there is a way to tell the user more explicitely what to do without insulting the user's intelligence ;-)

> > I wonder why you did not just "git branch -m somebranch".
> 
> Because they didn't know what on earth was going on, and git was 
> spitting out errors everywhere, they were afraid git would crash.

Yeah, I know those reactions. All of a sudden, people panic, destroying everything in the process. Do tell them to calm down first of all. Unless you do something like "rm -rf .git" or "git branch -d", it is actually pretty hard to lose data with Git.

Ciao, Dscho

Previous: John TapsellNext: John Tapsell
Message 5 of 20 in “git checkout -b origin/mybranch origin/mybranch”
  1. John TapsellMar 12, 2009
  2. Sverre RabbelierMar 12, 2009
  3. Johannes SchindelinMar 12, 2009
  4. John TapsellMar 12, 2009
  5. Johannes SchindelinMar 12, 2009
  6. John TapsellMar 12, 2009
  7. Sverre RabbelierMar 12, 2009
  8. John TapsellMar 12, 2009
  9. Michael J GruberMar 13, 2009
  10. Pieter de BieMar 12, 2009
  11. Jeff KingMar 12, 2009
  12. John TapsellMar 12, 2009
  13. Jeff KingMar 12, 2009
  14. Pieter de BieMar 12, 2009
  15. Jeff KingMar 12, 2009
  16. John TapsellMar 12, 2009
  17. Jeff KingMar 12, 2009
  18. John TapsellMar 12, 2009
  19. John TapsellMar 12, 2009
  20. Junio C HamanoMar 12, 2009

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.