git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git pull without fetch

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 18, 2023, 02:46 UTC
Message-ID
<xmqqo7prk7vj.fsf@gitster.g>
In-Reply-To
<fc7d9fdde0443532eb9c32f26f9f054e@rjp.ie>
ronan@rjp.ie writes:
Show 5 quoted lines
> 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.

Previous: ronan@rjp.ieNext: ronan@rjp.ie
Message 3 of 4 in “Git pull without fetch”
  1. ronan@rjp.ieFeb 18, 2023
  2. ronan@rjp.ieFeb 18, 2023
  3. Junio C HamanoFeb 18, 2023
  4. ronan@rjp.ieFeb 18, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.