Subject: Re: Git pull without fetch

From: Junio C Hamano <[email-masked]>
Date: Fri, 17 Feb 2023 18:46:56 -0800

[email-masked] writes:

> In the scenario described, `git rebase` will always report "Already up to date"
> because the head of the current branch and the head of the remote tracking
> branch are the same. The prefetched reference lives under refs/prefetch/* and is
> unnoticed by git rebase. This is why I used `git update-ref ...` first: to
> update the remote tracking branch from the prefetched copy.

That is very much working as designed.  Prefetching is merely a
performance thing---until the user explicitly says "I want to update
my view of the other side by fetching and updating the remote
tracking branches" with "git fetch", it will not disrupt
refs/remotes/origin/* refs, and because of prefetching, when the
user finally gets around to say that, observation of the other side
with a real fetch would go faster, requiring fewer objects to be
transmit.

And if somebody wants to lie to the system and say "pretend we did
not fetch anything", then yes, _knowing_ that implementation detail
of refs/prefetch/* hierarchy and taking advantage of it by using
"update-ref" would be a way to achieve that.