From: Jeff King Date: Sat, 25 Apr 2026 22:06:29 GMT Subject: Re: [PATCH] remote: add --set-head option to 'git remote add' Message-ID: <20260425220629.GA28590@coredump.intra.peff.net> In-Reply-To: On Sun, Apr 26, 2026 at 06:58:55AM +0900, Junio C Hamano wrote: > "Harald Nordgren via GitGitGadget" writes: > > > 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. > > Should this option (and the auto mode of "git remote set-head") even > be necessary as an extra thing that the end-user should need to be > aware of these days? > > It feels to me that the "fetch" part of "git remote add --fetch" > command should behave in line with what "git fetch" from the remote > does with "remote..followRemoteHEAD" configuration. It already does, doesn't it? Doing: $ git init $ git remote add --fetch origin /path/to/some/repo $ git for-each-ref shows an origin/HEAD link. Which I think is not too surprising, as it is just calling "git fetch" under the hood. -Peff