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

Re: Git pull without fetch

From
ronan@rjp.ie <ronan@rjp.ie>
Date
Feb 18, 2023, 04:33 UTC
Message-ID
<2aff5436d69e09241bee775cf03e9723@rjp.ie>
In-Reply-To
<xmqqo7prk7vj.fsf@gitster.g>
> That is very much working as designed.

Yes, I realize. I'm not reporting a bug. I guess I just think it would be handy to more conveniently reach the prefetched updates when I'm offline, and I gather from conversation there is no method builtin to git.

For now I've settled on this to be "pretend fetch":
$ git for-each-ref refs/prefetch/ --format='update refs/%(refname:lstrip=2) (refname)' | git update-ref --stdin

which I can follow-up with a no-argument `git rebase`, similar to a `git pull` if the remote was available.

In my original question I had intended only to update the upstream of my current branch, but I've decided that's not necessary for me. However, I have found that it is possible to get the upstream reference for the current branch like so:

$ git rev-parse --symbolic-full-name '@{upstream}' refs/remotes/origin/master

using this it should be possible to find the corresponding prefetched reference in refs/prefetch if it exists and only update that reference without parsing "branch.<name>.remote", "remote.<name>.fetch", and "branch.<name>.merge" myself.

Previous: Junio C Hamano
Message 4 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.