From: Ben Knoble <ben.knoble@gmail.com>
To: Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Harald Nordgren <haraldnordgren@gmail.com>
Subject: Re: [PATCH] remote: add --set-head option to 'git remote add'
Date: Sat, 25 Apr 2026 13:20:42 -0400 [thread overview]
Message-ID: <6F9060F0-20EB-4B60-8677-86DA2AB39B35@gmail.com> (raw)
In-Reply-To: <pull.2283.git.git.1777115978088.gitgitgadget@gmail.com>
> Le 25 avr. 2026 à 07:19, Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com> a écrit :
>
> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> Mirror the behavior 'git clone' applies to its first remote: after
> fetching, set refs/remotes/<name>/HEAD to the remote's default branch.
>
> Equivalent to running:
>
> git remote add -f <name> <url>
> git remote set-head <name> -a
>
> The new option implies --fetch.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---
> remote: add --set-head option to 'git remote add'
>
> When using GitHub's gh tool to fork a repo, it seems that set-head isn't
> run on the upstream remote. So its default branch is not recorded
> locally, meaning that 'git log fork' will not work.
>
> With git remote add --set-head upstream , the default branch is set in
> the same step and things can work out of the box after a small change on
> 'gh' that I will do as a next step.
I’m not totally opposed to this convenience, but couldn’t we also just teach gh to run set-head as a second command?
(Of course, it will need a version check; if memory serves not all Git versions used in practice have this command? But I am on mobile and have not validated the history of git-remote’s sub-commands.)
next prev parent reply other threads:[~2026-04-25 17:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-25 11:19 [PATCH] remote: add --set-head option to 'git remote add' Harald Nordgren via GitGitGadget
2026-04-25 17:20 ` Ben Knoble [this message]
2026-04-25 18:07 ` gh Harald Nordgren
2026-04-25 21:58 ` [PATCH] remote: add --set-head option to 'git remote add' Junio C Hamano
2026-04-25 22:06 ` Jeff King
2026-04-26 8:21 ` Harald Nordgren
-- strict thread matches above, loose matches on Subject: below --
2026-04-26 7:07 Wrong subject line Kristoffer Haugsbakk
2026-04-26 15:15 ` [PATCH] remote: add --set-head option to 'git remote add' Harald Nordgren
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=6F9060F0-20EB-4B60-8677-86DA2AB39B35@gmail.com \
--to=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=haraldnordgren@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.