From: Ben Knoble Date: Sat, 25 Apr 2026 17:20:42 GMT Subject: Re: [PATCH] remote: add --set-head option to 'git remote add' Message-ID: <6F9060F0-20EB-4B60-8677-86DA2AB39B35@gmail.com> In-Reply-To: > Le 25 avr. 2026 à 07:19, Harald Nordgren via GitGitGadget a écrit : > > From: Harald Nordgren > > Mirror the behavior 'git clone' applies to its first remote: after > fetching, set refs/remotes//HEAD to the remote's default branch. > > Equivalent to running: > > git remote add -f > git remote set-head -a > > The new option implies --fetch. > > Signed-off-by: Harald Nordgren > --- > 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.)