Re: Terminology question about remote branches.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Kastrup <dak@...>
Cc: <git@...>
Date: Saturday, August 4, 2007 - 9:29 am

On Sat, 04 Aug 2007 12:55:43 +0200
David Kastrup <dak@gnu.org> wrote:


Yes.


To be clear, it's the job of git-fetch to update remote-tracking branches
with any changes found in the remote repository.  Git-pull runs git-fetch
and then runs a git-merge to update the currently-checked-out branch.

When this happens, git-merge must decide which remote-tracking-branch
to merge into the currently checked out local branch.  You can set which
remote-tracking-branch will be selected in this situation with
the --track option.

So assuming a remote-repo has two branches "master" and "branchX":

   git clone remote-repo

will give us two remote-branch (AKA remote-tracking-branches) of
"origin/master" and "origin/branchX".  So:

   git branch --track mylocalbranch origin/branchX
   git checkout mylocalbranch

Creates a local branch named "mylocalbranch" that by default will
merge in any changes found in the remote-tracking branch
"origin/branchX".  Thus:

   git pull

First runs git fetch which will update all remote-tracking branches
such as origin/master and origin/branchX.  Then it runs git merge.
Git merge has to decide whether to merge in the changes from
origin/master or origin/branchX.  Because of the --track option used
to setup "mylocalbranch",  "origin/branchX" will be merged.


No, a local branch is never a remote-tracking branch; even when created
with a --track option.  The --track option has muddied the terminology
waters a bit and you're not the first to be confused by it.  The
--track selects a branch from the repo to merge by default.


Functionally, your understanding is correct.  But it helps when you
understand that remote-branches are the "real" remote-tracking-branches.
You don't commit to them locally, they are essentially read-only copies
of exactly what is happening in a remote repository.

A local --track branch, is one that merges changes from the proper
remote-tracking-branch, and is also a place where you can commit your
own work.


A remote branch and a remote-tracking branch are the same thing.
Strictly speaking a local branch is never a remote-tracking-branch
although the "--track" option makes that harder to explain.


Yeah, the documentation could use some fine tuning.

Sean
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Terminology question about remote branches., David Kastrup, (Sat Aug 4, 6:55 am)
Re: Terminology question about remote branches., Junio C Hamano, (Sun Aug 5, 3:31 am)
Re: Terminology question about remote branches., Julian Phillips, (Sun Aug 5, 10:23 am)
Re: Terminology question about remote branches., David Kastrup, (Sun Aug 5, 11:09 am)
Re: Terminology question about remote branches., Julian Phillips, (Sun Aug 5, 11:24 am)
Re: Terminology question about remote branches., Steffen Prohaska, (Sun Aug 5, 6:07 am)
Re: Terminology question about remote branches., Sean, (Sat Aug 4, 9:29 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 10:01 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 6:05 am)
Re: Terminology question about remote branches., Steffen Prohaska, (Sun Aug 5, 6:56 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 7:02 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 6:10 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 11:22 am)
Re: Terminology question about remote branches., Jeff King, (Sat Aug 4, 8:02 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 8:36 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 5:21 am)
Re: Terminology question about remote branches., David Kastrup, (Sun Aug 5, 5:29 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 5:32 am)
Re: Terminology question about remote branches., David Kastrup, (Sun Aug 5, 5:44 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 5:46 am)
Re: Terminology question about remote branches., Lars Hjemli, (Sat Aug 4, 9:07 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 1:00 pm)
Re: Terminology question about remote branches., Julian Phillips, (Sat Aug 4, 1:19 pm)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 2:00 pm)
Re: Terminology question about remote branches., Theodore Tso, (Sat Aug 4, 6:56 pm)
Re: Terminology question about remote branches., David Kastrup, (Sun Aug 5, 3:06 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 9:38 am)
Re: Terminology question about remote branches., Lars Hjemli, (Sat Aug 4, 10:03 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 10:11 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 10:25 am)
Re: Terminology question about remote branches., Julian Phillips, (Sat Aug 4, 10:50 am)
Re: Terminology question about remote branches., Lars Hjemli, (Sat Aug 4, 10:35 am)
Re: Terminology question about remote branches., David Kastrup, (Sat Aug 4, 11:09 am)
Re: Terminology question about remote branches., Jeff King, (Sun Aug 5, 5:24 am)
Re: Terminology question about remote branches., Lars Hjemli, (Sat Aug 4, 11:48 am)