Thread (1 message) 1 message, 1 author, 2016-08-11
  • (off-list ancestor, not in this archive)
  • Re: Pull and fetch · Paolo Ciarrocchi <hidden> · 2016-08-11

Re: Pull and fetch

From: Paolo Ciarrocchi <hidden>
Date: 2016-08-11 19:36:39

On 11/23/06, Sean [off-list ref] wrote:
On Thu, 23 Nov 2006 21:45:32 +0100
"Paolo Ciarrocchi" [off-list ref] wrote:
quoted
So it fetches into testbranchpull and merge its content with master.
Right?
Exactly.  You'll hear people say, git-pull is simply a fetch + a merge.
This is what they mean.
Fair enough.
quoted
Since master was empy I now have 3 identical branches if I'm getting
it correctly.
Yes.
quoted
Not so sure I've got everything.

If I do:
git checkout testbranch
edit file
git commit -a
git fetch ../git master:testbranch
You are not allowed to fetch changes into a branch you have modified
locally.   If you use the "-f" (force) option of fetch to force it,
your local commits will be lost.
OK
If you want to merge remote master changes into this testbranch
after you've updated, you'd want:

git pull ../git master

(which fetches the remote master into a hidden temp branch, and
then merges it with the locally checked out branch (testbranch))
Thanks, now I think I have a clear picture. I think it's worth to add
some more info to tutorial.txt about difference between fetch and
pull. I don't believe I'm the only confused user ;-)
quoted
Last command will merge my local change with the remote master but
will keep my local master unmodified, right?
No.. Fetch never merges, only copies remote data into your repo.
I was confused by the "merge" terminology, if I fetch to an empty
branch the concept of copy is easy to be understood, but if I fetch to
a branch that contains data then it's somehow more difficult to think
about fetching without thinking of "merge the remote branch into
local".

But now I think I understood it ;-)

But you're right, your local master would be unaffected.

Cheers,
Sean

P.S.  Please keep the questions on the list.  That way if i get something
wrong someone will correct it.  Someone else might be able to give
you a better answer too.
Sure, sorry about that. It was not my intention, I just pressed the
wrong button :)

Regards,
-- 
Paolo
http://docs.google.com/View?docid=dhbdhs7d_4hsxqc8
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help