Subject: Re: Did anyone have trouble learning the idea of local vs. remote branches?

From: Wink Saville <[email-masked]>
Date: Tue, 07 Nov 2006 21:23:29 -0800

As a newbie I'm confused, recently I attempted to get Andrew Morton's -mm "tree". It turns out the instructions were incorrect and Junio was kind enough to correct the mistake. But I for one am still confused.

  git-fetch is; "Download objects and a head from another repository"

Fair enough and that make sense, but where does it go? Apparently it just gets stored in the object database and a reference to it in "FETCH_HEAD". Now what? Ok the documentation says:

  'The information is left for a later merge operation done by "git merge"'

Now in the case of fetching -mm apparently you don't do a merge, instead the instructions now read:

  git-fetch git://git.kernel.org/pub/scm/linux/kernel/git/smurf/linux-trees.git tag v2.6.16-rc2-mm1
  git-checkout -b local-v2.6.16-rc2-mm1 v2.6.16-rc2-mm1

The git-fetch apparently gets "linux-trees.git" and places a reference to it in a tag named 'v2.6.16-rc2-mm1'. Then the git-checkout, check's out this tag to a new branch, there was no merge! This is confusing and makes no sense to this newbie.

Now lets take a quick look at the git-merge documentation "HOW MERGE WORKS":

"A merge is always between the current HEAD and one or more remote branch heads, and the index file must exactly match the tree of HEAD commit (i.e. the contents of the last commit) when it happens. In other words, git-diff --cached HEAD must report no changes."

Sorry, there is basically no information in those two sentences that makes any sense to me. Take the first part, "between the current HEAD and one or more remote branch heads". So apparently merges occur against the current checkout branch, but I would guess the origin is also involved somehow? Secondly, what is the relationship between "remote branch heads" and FETCH_HEAD? I see no mention of FETCH_HEAD or how it might be used anywhere in the git-merge documentation.  Then we come to "the index file must exactly match the tree HEAD commit", sorry but my question is how could it not match? Obviously I don't understand how the index file is used, but I can say that adding "git-diff --cached HEAD must report no no changes" adds nothing to the explanation, yet I'm sure it does mean something to an expert.

It then goes onto say "it may fetch the objects from remote" I thought that is what "fetch" does.

Anyway, as you can see there is room for confusion for some people.

Regards,