Subject: Re: Git pull without fetch

From: [email-masked]
Date: Sat, 18 Feb 2023 04:33:59 +0000

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