From: ronan@rjp.ie
To: git@vger.kernel.org
Subject: Git pull without fetch
Date: Sat, 18 Feb 2023 00:09:05 +0000 [thread overview]
Message-ID: <49c07b5dc2afbd422d492d59380ad2c2@rjp.ie> (raw)
Dear maintainers,
I use the git-maintenance prefetch task with a certain repo to periodically
fetch updates from the remote. I'm trying to figure out a way to have git
"complete" a prefetch on command, via an option, alias, or other extension that
mimics the behavior of git pull, but does not fetch from the remote. By
comparison, `git pull` or `git fetch && git rebase` would fetch the remote and
fast-forward my local copy to match, but I don't want to fetch the remote.
Instead I want to fast-forward my current branch (and the remote tracking
branch) to the prefetched tip as if git pull had been run at the time of the
last prefetch.
For example, suppose my local copy has a branch master that tracks the remote
branch master from origin. Suppose that the local copy (and the remote tracking
branch) have commits A--B, the remote has commits A--B--C--D, and commit C has
been prefetched and is pointed to by refs/prefetch/remotes/origin/master. The
desired effect could be accomplished, I think, by:
git update-ref refs/remotes/origin/master refs/prefetch/remotes/origin/master refs/heads/master &&
git rebase origin/master master
My question is, how can I calculate the correct remote tracking branch to
accomplish this operation in the general case, just as git pull without argument
would have done? Or is there a simpler way to achieve my goal?
Cheers,
Ronan
next reply other threads:[~2023-02-18 0:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 0:09 ronan [this message]
[not found] ` <CAPx1Gvd8vizeyveKgE2o2GStQsiGxN4aaASqYc81Nk28ogFLJg@mail.gmail.com>
2023-02-18 2:02 ` Git pull without fetch ronan
2023-02-18 2:46 ` Junio C Hamano
2023-02-18 4:33 ` ronan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49c07b5dc2afbd422d492d59380ad2c2@rjp.ie \
--to=ronan@rjp.ie \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox