From: Matthias Goergens <matthias.goergens@gmail.com>
To: git@vger.kernel.org
Cc: "Niklas Cassel" <cassel@kernel.org>,
"Bence Ferdinandy" <bence@ferdinandy.com>,
"Philip Oakley" <philipoakley@iee.org>,
"Jean-Noël Avila" <jn.avila@free.fr>
Subject: [PATCH] doc: clarify that set-head does not change the remote's HEAD
Date: Sun, 27 Sep 2026 13:50:40 +0800 [thread overview]
Message-ID: <20260927055040.2441925-1-matthias.goergens@gmail.com> (raw)
`git remote set-head <name> <branch>` never changes the remote
repository's own `HEAD`, i.e. the branch that a fresh `git clone` of
that remote checks out; every change it makes is local.
The current wording, "Set or delete the default branch ... for the
named remote", reads as though the command changes the remote itself.
It was recently misread that way in a discussion on another project's
mailing list, until a test showed the remote's `HEAD` unchanged.
Say that the change is local and that Git offers no client-side way to
change a remote's own default branch.
Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
---
The misreading is in this sub-thread of a Linux MAINTAINERS patch:
https://lore.kernel.org/all/arfrW8NmQ4tsCF2I@ryzen/
On a gitolite server, the remote's HEAD can be changed with gitolite's
symbolic-ref command, if the site enables it. On kernel.org, for
example:
ssh git@gitolite.kernel.org symbolic-ref pub/scm/<repo> HEAD refs/heads/<branch>
(https://korg.docs.kernel.org/gitolite/index.html#symbolic-ref). If a
client-side way would be welcome, e.g. a push option that receive-pack
honours, I could look into it.
Documentation/git-remote.adoc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/git-remote.adoc b/Documentation/git-remote.adoc
index eaae30aa88..c9cf17e7bd 100644
--- a/Documentation/git-remote.adoc
+++ b/Documentation/git-remote.adoc
@@ -107,6 +107,12 @@ branch. For example, if the default branch for `origin` is set to
`master`, then `origin` may be specified wherever you would normally
specify `origin/master`.
+
+This command does not change the remote repository's own `HEAD`, i.e.
+the branch that a fresh `git clone` of that remote will check out;
+every change it makes is local. Git provides no way to change a
+remote's own default branch from the client; how that is done depends
+on how the remote is hosted.
++
With `-d` or `--delete`, the symbolic ref `refs/remotes/<name>/HEAD` is deleted.
+
With `-a` or `--auto`, the remote is queried to determine its `HEAD`, then the
--
2.55.0
next reply other threads:[~2026-09-27 5:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 5:50 Matthias Goergens [this message]
2026-09-28 19:01 ` [PATCH] doc: clarify that set-head does not change the remote's HEAD Junio C Hamano
2026-09-29 12:00 ` [PATCH v2] doc: remote: say that it only affects the local repository Matthias Goergens
2026-09-29 16:28 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260927055040.2441925-1-matthias.goergens@gmail.com \
--to=matthias.goergens@gmail.com \
--cc=bence@ferdinandy.com \
--cc=cassel@kernel.org \
--cc=git@vger.kernel.org \
--cc=jn.avila@free.fr \
--cc=philipoakley@iee.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox