Re: Pull without fetch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2019, 01:34 UTC
- Message-ID
- <xmqq4l79cmb4.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190406131200.xcd7gtf7dlc567uh@doriath>
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, "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.