Re: [PATCH 1/3] fetch: add --allow-local option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 16, 2013, 23:24 UTC
- Message-ID
- <7vk3my33vb.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAMP44s2W5MUneTwcSnr=Ey715paKgSL6MqXmYKdSmw4NqdL4qQ@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 19 quoted lines
> On Thu, May 16, 2013 at 1:04 PM, Junio C Hamano <gitster@pobox.com> wrote: >> Felipe Contreras <felipe.contreras@gmail.com> writes: >> >>>> If you come from "git pull" is "git fetch" + "git merge", >>>> and if your current branch is integrating with your local branch, >>> >>> How many times do I have to say that 'git pull' is not 'git fetch' + >>> 'git merge'? >>> >>> You must think everybody has 'merge.defaulttoupstream=true'. >> >> I am confused. What does that have anything to do with this topic? >> It only affects what a lazy "git merge" (without any other parameter >> on the command line) does, doesn't it? > > And that's what we are talking about here; commands without any other > parameter in the command like. > > So "git pull $nothing" is *not* "git fetch $nothing" + "git merge $nothing".
Of course not. But what does it change the equation?
Let's rephrase the above, then.
"git pull" with 0 or more arguments is to first
- make sure that necessary history is available in your
repository- prepare FETCH_HEAD to record what is to be merged
which is done by running "git fetch" with appropriate
arguments against the repository of your upstream, and then
to- merge the upstream history
which is done by running "git merge" with appropriate
arguments (which in turn is formulated by reading FETCH_HEAD
that is left by the previous "git fetch" step).So if your "upstream" happens to live in a local repository, it is very natural to run "git fetch" against repository "." (with appropriate arguments, like 'refs/heads/master' if you were on your mywork branch that was forked from your 'master' branch). Running "git fetch ." is hardly "does not make any sense whatever" from that point of view. It is just a natural consequence that our local repository is merely one of the repositories we could fetch/pull from.