git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Pull and fetch

From
PCPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Date
Nov 24, 2006, 09:30 UTC
Message-ID
<4d8e3fd30611240130m2d04efe8qcc8bb5d61f8c7386@mail.gmail.com>
In-Reply-To
<BAYC1-PASMTP11A008C336418A659F0E75AEE20@CEZ.ICE>
On 11/23/06, Sean <seanlkml@sympatico.ca> wrote:
> On Thu, 23 Nov 2006 21:45:32 +0100
> "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com> wrote:
Show 5 quoted lines
> > 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.
Show 16 quoted lines
> > 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
Show 7 quoted lines
> 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 ;-)
Show 8 quoted lines
> 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
Previous: Paolo Ciarrocchi
Message 6 of 6 in “Pull and fetch”
  1. Paolo CiarrocchiNov 23, 2006
  2. SeanNov 23, 2006
  3. J. Bruce FieldsNov 24, 2006
  4. Documentation: clarify tutorial pull/merge discussionJ. Bruce Fields, Nov 26, 2006
  5. Paolo CiarrocchiNov 26, 2006
  6. Paolo CiarrocchiNov 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.