git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Chris Torek <chris.torek@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Sam Bostock <sam.bostock@shopify.com>,
	Git List <git@vger.kernel.org>
Subject: Re: `git fetch` not updating 'origin/HEAD' after branch rename
Date: Wed, 14 Apr 2021 01:29:39 -0400	[thread overview]
Message-ID: <YHZ9w6MVMMHMxGeA@coredump.intra.peff.net> (raw)
In-Reply-To: <CAPx1GvdeNEyPEZ7GdRKeAevnvjyLmoXHjQP0W6iToDsJPAqDHA@mail.gmail.com>

On Tue, Apr 13, 2021 at 05:26:02PM -0700, Chris Torek wrote:

> On Tue, Apr 13, 2021 at 5:18 PM Sam Bostock <sam.bostock@shopify.com> wrote:
> > Long story short, it seems to me that `git fetch` should update
> > "refs/remotes/origin/HEAD" when the upstream HEAD changes, but it
> > doesn't.
> 
> It's never been the *intent* to have `git fetch` update
> the corresponding remote-tracking `HEAD` ref.  To make
> that happen, you must run `git remote`:
> 
>     git remote set-head origin -a
> 
> for instance.
> 
> I have, however, often thought that this is the wrong
> *default* way for things to work, and that at least by default,
> `git fetch origin` should update `origin/HEAD` if the
> fetch result indicates that it should.  See also Junio's
> reply.  I think a configuration knob (similar to `fetch.prune`)
> would be reasonable here.  Users could then be encouraged
> to set `fetch.prune` to `true`, and `fetch.update-remote-HEAD`
> (or whatever) to `true` as well.

I think so, too. The previous discussion Junio referred to it is here:

  https://lore.kernel.org/git/20201118091219.3341585-1-felipe.contreras@gmail.com/

If you do read it, note that the parts of the conversation about unborn
heads are out of date. We do pick this up via clone these days, courtesy
of the commits in 69571dfe21 (Merge branch 'jt/clone-unborn-head',
2021-02-17).

-Peff

  reply	other threads:[~2021-04-14  5:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 20:25 `git fetch` not updating 'origin/HEAD' after branch rename Sam Bostock
2021-04-13 20:37 ` Junio C Hamano
2021-04-13 21:09   ` Andreas Schwab
2021-04-13 21:22     ` Junio C Hamano
2021-04-14  0:26 ` Chris Torek
2021-04-14  5:29   ` Jeff King [this message]
2021-04-14 10:56   ` Ævar Arnfjörð Bjarmason
2021-04-14 12:03     ` Andreas Schwab
2021-04-14 21:12       ` Junio C Hamano
2021-04-15  9:28     ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHZ9w6MVMMHMxGeA@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=chris.torek@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sam.bostock@shopify.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).