Re: git remote set-head automatically
- From
Bence Ferdinandy <bence@ferdinandy.com>
- Date
- Jan 12, 2025, 08:19 UTC
- Message-ID
- <D6ZY4MU53E2I.3LWESUZX6TR5A@ferdinandy.com>
- In-Reply-To
- <CAAHKNRF8JDUTH-QzPG1b4-wafzU+MXaMNinfBRu3JfCssfwGUw@mail.gmail.com>
On Tue Nov 19, 2024 at 16:40, Caleb Cushing <xenoterracide@gmail.com> wrote:
Show 18 quoted lines
> sounds great. I think I realized why I didn't have it. It's not done > by `git remote add <origin> https://...` my experiment was `git > remote rm origin` and then `git remote add origin ... ; git fetch > --all --prune` I think I also tried without the prune option. git > version 2.46.1 > > What I want mostly is for that HEAD ref to always exist. As far as > there being ways to configure it, that's all good but I don't want to > explain doing that to consumers of my code. I'd rather it just work > for them, on clones, and add remotes or fetch if it's missing. > > I'm not super worried about it being updated as I feel like if that > ever happens it's something loudly communicated, and I'm more willing > to find it ok to make that an FAQ, if this breaks because that changed > you can manually update that. Mostly I'm of the opinion that what I'm > doing needs to work in various CI environments out of the box. > > Thanks for the info, hopefully soon (tm).
It's in the new release now, it also got some configuration options, but the default should be what you want
https://git-scm.com/docs/git-config#Documentation/git-config.txt-remoteltnamegtfollowRemoteHEAD
Best, Bence