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

Re: Cloning into an existing, non-empty directory?

From
Jeff King <peff@peff.net>
Date
Apr 25, 2011, 18:37 UTC
Message-ID
<20110425183715.GA24069@sigill.intra.peff.net>
In-Reply-To
<20110425085913.GB28885@elie>
On Mon, Apr 25, 2011 at 03:59:13AM -0500, Jonathan Nieder wrote:
> who wonders where his origin/HEAD symref came from and if
> "git remote set-head --auto origin" was ever automatic

It is created by "clone", but not by "git remote add". The "auto" in remote's "set-head" means "right now, look up the HEAD on the remote and set our $remote/HEAD based on it". Not anything about being set up or tracked automatically.

Perhaps "git remote add" should automatically do "set-head --auto", just as if you had cloned. I think the main reason against it is that doing so requires hitting the network, which "remote add" (without "-f") does not otherwise need to do.

Certainly if we are doing "-f", it would not be a big deal. In other cases, we could perhaps fill in the value on the first "fetch", but we may need infrastructure to know when we are on the first fetch (and it is not simply the case that the user deleted $remote/HEAD themselves).

-Peff
Previous: Jonathan NiederNext: Richard Hartmann
Message 11 of 12 in “Cloning into an existing, non-empty directory?”
  1. Richard HartmannApr 21, 2011
  2. Jonathan NiederApr 21, 2011
  3. Richard HartmannApr 22, 2011
  4. Jonathan NiederApr 23, 2011
  5. Nguyen Thai Ngoc DuyApr 23, 2011
  6. Jonathan NiederApr 23, 2011
  7. Richard HartmannApr 23, 2011
  8. Jonathan NiederApr 25, 2011
  9. Andreas SchwabApr 25, 2011
  10. Jonathan NiederApr 25, 2011
  11. Jeff KingApr 25, 2011
  12. Richard HartmannApr 25, 2011

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.