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

Re: Local clone checks out wrong branch based on remote HEAD

From
Jeff King <peff@peff.net>
Date
Mar 19, 2009, 04:02 UTC
Message-ID
<20090319040229.GA32435@coredump.intra.peff.net>
In-Reply-To
<49C0C769.8020401@drmicha.warpmail.net>
On Wed, Mar 18, 2009 at 11:05:29AM +0100, Michael J Gruber wrote:
Show 5 quoted lines
> One might even argue that in case of ambiguities, checking out a
> detached head would be most appropriate. Really, why impose creation of
> certain local branches on a user at all, unless asked for? Detached
> heads are natural in git! But I don't really expect positive consensus
> on that one...
I'm not sure that detached HEADs are all that natural. It means that:
  git clone repo-with-ambiguous-HEAD foo
  cd foo
  hack hack hack
  git commit -a -m msg

is putting your commits "nowhere" (i.e., not on any ref). They are not accessible for pushing, and when you checkout another branch, they will be lost (except to the reflog).

So it clearly requires that the user be aware of what is going on, and that they understand the subtleties of detached HEADs (something that has caused new user confusion before, I think).

-Peff
Previous: Jeff King
Message 10 of 10 in “Local clone checks out wrong branch based on remote HEAD”
  1. Tom Preston-WernerMar 17, 2009
  2. Daniel BarkalowMar 17, 2009
  3. Junio C HamanoMar 17, 2009
  4. Jeff KingMar 18, 2009
  5. Nanako ShiraishiMar 17, 2009
  6. Jeff KingMar 18, 2009
  7. Michael J GruberMar 18, 2009
  8. Jay SoffianMar 18, 2009
  9. Jeff KingMar 19, 2009
  10. Jeff KingMar 19, 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.