Thread (1 message) 1 message, 1 author, 2016-06-15

Re: default remote branch

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:06:38

Thibault Kruse [off-list ref] writes:
Also, I tried finding out whether I can use the
.git/refs/remotes/<remote>/HEAD to check the default branch without
accessing the remote. However, I find this file is not updated with a
git fetch, nor created when missing.
That is more or less deliberate.  Which one of the branches to
consider the primary one becomes a local decision after you clone.
If that was a good choice may be debatable, but that is how existing
users expect things to work.
So is there a sane way to get the last know default branch without
accessing the remote?
"The last known" is not updated, due to "where remotes/origin/HEAD
points at is a local matter" design; there is nothing that locally
stores the information you are asking for, so there is no offline
way to answer that question.

An early part of the protocol exchange "git clone" does carry that
information, but I do not think there is a command to ask that to
the remote.  A logical place to add it would be a new option to "git
ls-remote", I would think.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help