From: Paolo Ciarrocchi Date: Fri, 24 Nov 2006 09:30:33 GMT Subject: Re: Pull and fetch Message-ID: <4d8e3fd30611240130m2d04efe8qcc8bb5d61f8c7386@mail.gmail.com> In-Reply-To: On 11/23/06, Sean wrote: > On Thu, 23 Nov 2006 21:45:32 +0100 > "Paolo Ciarrocchi" wrote: > > 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. > > Since master was empy I now have 3 identical branches if I'm getting > > it correctly. > > Yes. > > > 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 ;-) > > 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