Re: Pull and fetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/23/06, Sean <seanlkml@xxxxxxxxxxxx> wrote:
On Thu, 23 Nov 2006 21:45:32 +0100
"Paolo Ciarrocchi" <paolo.ciarrocchi@xxxxxxxxx> 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
http://www.linkedin.com/pub/0/132/9a3
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]