From: Junio C Hamano <gitster@pobox.com>
To: Caleb Cushing <xenoterracide@gmail.com>
Cc: Bence Ferdinandy <bence@ferdinandy.com>,
Jeff King <peff@peff.net>,
git@vger.kernel.org
Subject: Re: git remote set-head automatically
Date: Wed, 20 Nov 2024 10:17:37 +0900 [thread overview]
Message-ID: <xmqqv7wiaeku.fsf@gitster.g> (raw)
In-Reply-To: <CAAHKNRF8JDUTH-QzPG1b4-wafzU+MXaMNinfBRu3JfCssfwGUw@mail.gmail.com> (Caleb Cushing's message of "Tue, 19 Nov 2024 10:40:55 -0500")
Caleb Cushing <xenoterracide@gmail.com> writes:
> 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
Yes, "git fetch" does not notice a missing remotes/$name/HEAD and
does not automatically create it.
This is being worked on in a separate thread.
Doing it unconditionally may hurt some existing users (including me)
who see more than one primarily interesting branches in a single
remote and want to force themselves to be more explicit, though.
For us, leaving remotes/$name/HEAD missing (e.g. by "git clone"
followed by "git update-ref --no-deref -d refs/remotes/origin/HEAD")
is a way to allow ourselves to say things like
$ git checkout -b mytopic origin/maint
$ git rebase origin/master mytopic
but not
$ git checkout --detach origin
because the last one is ambiguous between the two branches of
primary interest.
But hopefully they have trained their fingers not to say "origin" by
now ;-) So changing "git fetch" to auto-fill remotes/origin/HEAD to
whatever branch the remote is pointing at at the time of running
would be good enough for an initial enhanced version, even though we
might need to further improve on by allowing folks to opt out of the
feature.
next prev parent reply other threads:[~2024-11-20 1:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 14:34 git remote set-head automatically Caleb Cushing
2024-11-16 3:36 ` Jeff King
2024-11-16 15:01 ` Bence Ferdinandy
2024-11-19 15:40 ` Caleb Cushing
2024-11-19 17:06 ` Caleb Cushing
2024-11-19 18:44 ` Jeff King
2024-11-20 1:10 ` Junio C Hamano
2024-11-20 1:17 ` Junio C Hamano [this message]
2024-11-20 8:58 ` Bence Ferdinandy
2025-01-12 8:19 ` Bence Ferdinandy
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=xmqqv7wiaeku.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bence@ferdinandy.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=xenoterracide@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox