From: David Kastrup <dak@gnu.org>
To: Sean <seanlkml@sympatico.ca>
Cc: git@vger.kernel.org
Subject: Re: Terminology question about remote branches.
Date: Sat, 04 Aug 2007 16:01:55 +0200 [thread overview]
Message-ID: <85ejijgzzg.fsf@lola.goethe.zz> (raw)
In-Reply-To: <20070804092933.aaec6d52.seanlkml@sympatico.ca> (Sean's message of "Sat\, 4 Aug 2007 09\:29\:33 -0400")
Sean <seanlkml@sympatico.ca> writes:
> David Kastrup <dak@gnu.org> wrote:
>
>> A local branch is one with a local branch head. In contrast,
>> checking out a remote branch, while possible, leaves one with a
>> detached head.
>
> Yes.
>
>> "remote-tracking" basically means that git-pull will update the
>> branch according to changes in the remote repository.
>
> 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
So --track does not set up a tracking branch, but makes a local
_following_ branch _refer_ to a tracking branch.
What happens with
git checkout origin/branchX
git branch --track mylocalbranch
git checkout mylocalbranch
? What if after the checkout (which leads to a detached head) I check
in a few things, and then decide to name the branch and set it up as
following a remote tracking branch? Instead of using git-branch for
setting up the following, do I have to explicitly add the respective
"remote" line (which does not specify a remote, but a remote tracking
branch) into, uh, where?
> 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.
Well, GOOD. I have already come to the conclusion that the "--track"
option, like the "remote" configuration recorded by it have the main
purpose of confusing people and should not be confused with setting up
a remote tracking branch, or referring to a remote branch.
> 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.
You bet.
>> So the terminology seems fuzzy at the moment, and my attempt to
>> clear it up might not be the preferred way of doing it.
>
> Yeah, the documentation could use some fine tuning.
It is much too fine-tuned already. I think that first option names
and config file options need to get some coarse-tuning where one does
not have to split hairs and ignore the meaning of terms in order to
understand them.
I have now "following" or "automerge" local branches which are set up
to follow a "remote tracking" branch. Presumably, if I do
git-branch -b new-branch --track remote-branch
then I get a following branch set up which follows/automerges a remote
tracking branch. So far so good. What do I get with
git-branch -b another-new-branch --track new-branch
Does this follow/automerges with new-branch? Does this
follow/automerge with remote-branch?
What if I do
git-checkout remote-branch
git-branch -b new-branch --track
Does this follow anything?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
next prev parent reply other threads:[~2007-08-04 14:02 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-04 10:55 Terminology question about remote branches David Kastrup
2007-08-04 12:02 ` Jeff King
2007-08-04 12:36 ` David Kastrup
2007-08-04 13:07 ` Lars Hjemli
2007-08-04 13:38 ` David Kastrup
2007-08-04 14:03 ` Lars Hjemli
2007-08-04 14:11 ` David Kastrup
2007-08-04 14:25 ` David Kastrup
2007-08-04 14:35 ` Lars Hjemli
2007-08-04 15:09 ` David Kastrup
2007-08-04 15:48 ` Lars Hjemli
2007-08-05 9:24 ` Jeff King
2007-08-04 14:50 ` Julian Phillips
2007-08-04 17:00 ` David Kastrup
2007-08-04 17:19 ` Julian Phillips
2007-08-04 18:00 ` David Kastrup
2007-08-04 22:56 ` Theodore Tso
2007-08-05 7:06 ` David Kastrup
2007-08-05 9:21 ` Jeff King
2007-08-05 9:29 ` David Kastrup
2007-08-05 9:32 ` Jeff King
2007-08-05 9:44 ` David Kastrup
2007-08-05 9:46 ` Jeff King
2007-08-04 12:14 ` Jakub Narebski
2007-08-04 13:29 ` Sean
2007-08-04 14:01 ` David Kastrup [this message]
2007-08-04 14:48 ` Sean
2007-08-04 15:22 ` David Kastrup
2007-08-05 10:10 ` Jeff King
2007-08-05 10:05 ` Jeff King
2007-08-05 10:56 ` Steffen Prohaska
2007-08-05 11:02 ` Jeff King
2007-08-05 11:38 ` David Kastrup
2007-08-05 11:52 ` Jeff King
2007-08-05 12:12 ` David Kastrup
2007-08-05 12:14 ` Jeff King
2007-08-05 15:48 ` Theodore Tso
2007-08-05 16:23 ` David Kastrup
2007-08-05 16:27 ` Randal L. Schwartz
2007-08-05 16:40 ` Sean
2007-08-05 16:45 ` Jeff King
2007-08-05 7:31 ` Junio C Hamano
2007-08-05 10:07 ` Steffen Prohaska
2007-08-05 14:23 ` Julian Phillips
2007-08-05 15:09 ` David Kastrup
2007-08-05 15:24 ` Julian Phillips
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85ejijgzzg.fsf@lola.goethe.zz \
--to=dak@gnu.org \
--cc=git@vger.kernel.org \
--cc=seanlkml@sympatico.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox