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

Re: Pull without fetch

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 8, 2019, 12:51 UTC
Message-ID
<877ec4acdo.fsf@evledraar.gmail.com>
In-Reply-To
<CACsJy8B_-r-=LxzvdnY44H7Bnydijqu4+GvWOy3r+hP723uezA@mail.gmail.com>
On Mon, Apr 08 2019, Duy Nguyen wrote:
Show 34 quoted lines
> On Mon, Apr 8, 2019 at 8:34 AM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Damien Robert <damien.olivier.robert@gmail.com> writes:
>>
>> > is there a way to do a git pull without it running git fetch?
>> > Looking at the source in builtin/pull.c does not seem to indicate so.
>>
>> The reason behind that is because it does not make any sense for
>> "pull", which is meant as a quick short-cut to say "fetch && merge",
>> not to run fetch, especially back then when 'git pull' was designed,
>> the world was much simpler.  There was no "fetch && rebase", our
>> branches did not know what their @{upstream}s were.  In that simpler
>> world, what you are trying to do would have been:
>>
>>         git fetch
>>         # did I get anything worth integrating?
>>         git merge FETCH_HEAD
>>
>> That obviously would not work for those with "pull.rebase", and I do
>> not think it makes much sense to teach "git rebase" the same trick
>> to read FETCH_HEAD as "git merge" does in the above sequence.
>>
>> Others may have a better idea, but I do not immediately see any
>> solution better than inventing a new option to "git pull".
>>
>> Another and better option that may be harder to arrange is to make
>> sure that a no-op "git fetch" incurs very low cost.  If you did so,
>
> Not exactly related. But I often wish to see the list of branch
> updates since the last fetch. There's no easy way (that I know) to do
> this unless you copy the last fetch's output somewhere. If this "fetch
> at low cost" could simply read FETCH_HEAD and summarizes it like a
> normal fetch, that would be great. And it should also be very low cost
> because we only replay the last part (making summary) of normal fetch.

The ability to have this is something reftables will provide (from my memory of a comment by Stefan Beller), which Christian Couder is working on implementing these days.

>> "git fetch && git pull" would perform just like your "git fetch &&
>> git pull --no-fetch", and we won't need a new option at all.
Previous: Duy NguyenNext: Duy Nguyen
Message 4 of 9 in “Pull without fetch”
  1. Damien RobertApr 6, 2019
  2. Junio C HamanoApr 8, 2019
  3. Duy NguyenApr 8, 2019
  4. Ævar Arnfjörð BjarmasonApr 8, 2019
  5. Duy NguyenApr 8, 2019
  6. Damien RobertApr 8, 2019
  7. Damien RobertApr 8, 2019
  8. Junio C HamanoApr 9, 2019
  9. Damien RobertApr 11, 2019

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.