git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* `git fetch` not updating 'origin/HEAD' after branch rename
@ 2021-04-13 20:25 Sam Bostock
  2021-04-13 20:37 ` Junio C Hamano
  2021-04-14  0:26 ` Chris Torek
  0 siblings, 2 replies; 10+ messages in thread
From: Sam Bostock @ 2021-04-13 20:25 UTC (permalink / raw)
  To: git

Hi!

Hopefully I followed the instructions on https://git-scm.com/community
correctly to report this bug.

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. See my filled out bug report below.

Thanks,

Sam

----

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

1. Clone a repo with some branch name (say "master") from some remote
origin (say GitHub).
2. Replace/rename the main branch on the remote (say "main").
3. Run `git fetch` locally to sync with remote.
4. Run `git rev-parse --abbrev-ref --verify origin/HEAD`.

What did you expect to happen? (Expected behavior)

The `git fetch` should update the refs accordingly so "origin/HEAD"
now points to
the new branch, which should be output from the command above:

    $ git rev-parse --abbrev-ref --verify origin/HEAD
    origin/main

What happened instead? (Actual behavior)

The "origin/HEAD" ref seems to not point to anything anymore (because the
branch it was pointing to was "deleted"). `git fetch` fails to update
it to reflect the change.

    $ git rev-parse --abbrev-ref --verify origin/HEAD
    fatal: Needed a single revision

What's different between what you expected and what actually happened?

The HEAD on origin has changed, but this change is not reflected in
the local refs by `git fetch`.

Anything else you want to add:

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.30.2
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /nix/store/74shlfgb18717ixjlpivpxd7iqcyhyn5-bash-4.4-p23/bin/bash
uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05
PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
compiler info: clang: 7.1.0 (tags/RELEASE_710/final)
libc info: no libc information available
$SHELL (typically, interactive shell): /usr/local/bin/bash


[Enabled Hooks]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-04-15  9:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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