{"thread":{"id":"40379","subject":"default remote branch","startedAt":"2015-09-18T09:50:25Z","lastAt":"2015-09-21T17:16:49Z","messageCount":2,"participants":["Thibault Kruse","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"270284","messageId":"CAByu6UUxsWu5RVar=8uKJw3kZpxjawqbwABgNREjJ3g3mGDwVA@mail.gmail.com","threadId":"40379","inReplyTo":null,"subject":"default remote branch","fromName":"Thibault Kruse","fromEmail":"tibokruse@googlemail.com","sentAt":"2015-09-18T09:50:25Z","receivedAt":"2015-09-18T09:50:25Z","isPatch":false,"sender":{"key":"tibokruse@googlemail.com","avatar":"https://gravatar.com/avatar/68c46b980bae1554690b4e334db8e5102b7fc25afae6bba2fdf48ce1243cc0c6?d=mp&s=160"},"body":"Hi,\n\nthe 'git remote show <remote>' command shows the default branch among\nother things.\nThe default branch being the branch that a clone will have immediately\nafter cloning.\n\nIs it possible to run a command that only shows that default branch\nfor a given remote?\n\nAlso, I tried finding out whether I can use the\n.git/refs/remotes/<remote>/HEAD to check the default branch without\naccessing the remote. However, I find this file is not updated with a\ngit fetch, nor created when missing.\n\nSo is there a sane way to get the last know default branch without\naccessing the remote?\nIf so, is there a way to update local information about the default\nbranch of a remote?\n\ncheers,\n  Thibault\n"},{"id":"270407","messageId":"xmqqd1xbbsla.fsf@gitster.mtv.corp.google.com","threadId":"40379","inReplyTo":"CAByu6UUxsWu5RVar=8uKJw3kZpxjawqbwABgNREjJ3g3mGDwVA@mail.gmail.com","subject":"Re: default remote branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-21T17:16:49Z","receivedAt":"2015-09-21T17:16:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thibault Kruse <tibokruse@googlemail.com> writes:\n\n> Also, I tried finding out whether I can use the\n> .git/refs/remotes/<remote>/HEAD to check the default branch without\n> accessing the remote. However, I find this file is not updated with a\n> git fetch, nor created when missing.\n\nThat is more or less deliberate.  Which one of the branches to\nconsider the primary one becomes a local decision after you clone.\nIf that was a good choice may be debatable, but that is how existing\nusers expect things to work.\n\n> So is there a sane way to get the last know default branch without\n> accessing the remote?\n\n\"The last known\" is not updated, due to \"where remotes/origin/HEAD\npoints at is a local matter\" design; there is nothing that locally\nstores the information you are asking for, so there is no offline\nway to answer that question.\n\nAn early part of the protocol exchange \"git clone\" does carry that\ninformation, but I do not think there is a command to ask that to\nthe remote.  A logical place to add it would be a new option to \"git\nls-remote\", I would think.\n"}]}