Git development
 help / color / mirror / Atom feed
From: "Bence Ferdinandy" <bence@ferdinandy.com>
To: "Junio C Hamano" <gitster@pobox.com>,
	"Caleb Cushing" <xenoterracide@gmail.com>
Cc: "Jeff King" <peff@peff.net>, <git@vger.kernel.org>
Subject: Re: git remote set-head automatically
Date: Wed, 20 Nov 2024 09:58:40 +0100	[thread overview]
Message-ID: <D5QVRMGNDJ3A.4INI8UF7PDW5@ferdinandy.com> (raw)
In-Reply-To: <xmqqv7wiaeku.fsf@gitster.g>

On Wed Nov 20, 2024 at 02:17, Junio C Hamano <gitster@pobox.com> wrote:
> 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.

You learn every day :) I had no idea that the remote's name works this way.

Thanks!

>
> 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.


  reply	other threads:[~2024-11-20  8:59 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
2024-11-20  8:58         ` Bence Ferdinandy [this message]
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=D5QVRMGNDJ3A.4INI8UF7PDW5@ferdinandy.com \
    --to=bence@ferdinandy.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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