{"thread":{"id":"39999","subject":"Fetch and refs/remotes/<refname>/HEAD","startedAt":"2015-08-03T13:28:05Z","lastAt":"2015-08-09T23:23:31Z","messageCount":2,"participants":["Dror Livne","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"267311","messageId":"loom.20150803T151815-131@post.gmane.org","threadId":"39999","inReplyTo":null,"subject":"Fetch and refs/remotes/<refname>/HEAD","fromName":"Dror Livne","fromEmail":"dror.livne@mobileye.com","sentAt":"2015-08-03T13:28:05Z","receivedAt":"2015-08-03T13:28:05Z","isPatch":false,"sender":{"key":"dror.livne@mobileye.com","avatar":null},"body":"I have noticed that when cloning a repository, I get a\nrefs/remotes/origin/HEAD symbolic ref.\n\nOn the other hand, when fetching a new remote, the remote HEAD is not set by\ngit-fetch (but can be added later by `git remote set-head ...')\n\nI was under the impression that clone is equivalent to (at least) init+fetch.\n\nIs there a rationale for that difference in behavior?\n\nDror Livne\n"},{"id":"267698","messageId":"20150809232330.GA25769@sigill.intra.peff.net","threadId":"39999","inReplyTo":"loom.20150803T151815-131@post.gmane.org","subject":"Re: Fetch and refs/remotes/<refname>/HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-08-09T23:23:31Z","receivedAt":"2015-08-09T23:23:31Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 03, 2015 at 01:28:05PM +0000, Dror Livne wrote:\n\n> I have noticed that when cloning a repository, I get a\n> refs/remotes/origin/HEAD symbolic ref.\n> \n> On the other hand, when fetching a new remote, the remote HEAD is not set by\n> git-fetch (but can be added later by `git remote set-head ...')\n> \n> I was under the impression that clone is equivalent to (at least) init+fetch.\n> \n> Is there a rationale for that difference in behavior?\n\nI have been annoyed by this in the past, too. There's no real reason,\nexcept that setting up the symref is outside the scope of \"fetch\".\nFetching is just about updating refs, and we explicitly do not want\nsubsequent fetches to overwrite any changes you might make to\nrefs/remotes/.../HEAD.\n\nSetting up the remote HEAD symref more rightly belongs to \"git remote\nadd\", but that program does not otherwise talk to the remote. And that's\nwhy we end up with the separate set-head step.  It might make sense for\n\"git remote add -f\" to automatically run \"set-head\", since it is\ncontacting the remote server already. And then:\n\n  git init\n  git remote add -f origin ...\n\nwould be similar to \"git clone\".\n\n-Peff\n"}]}