From: Sean Date: Sat, 04 Aug 2007 14:48:51 GMT Subject: Re: Terminology question about remote branches. Message-ID: <20070804104851.162d7e00.seanlkml@sympatico.ca> In-Reply-To: <85ejijgzzg.fsf@lola.goethe.zz> On Sat, 04 Aug 2007 16:01:55 +0200 David Kastrup wrote: > So --track does not set up a tracking branch, but makes a local > _following_ branch _refer_ to a tracking branch. Sure, that's one way to describe it; perhaps it would be best if we switched to that nomenclature in the documentation. > What happens with > > git checkout origin/branchX > git branch --track mylocalbranch > git checkout mylocalbranch This is easy to test, and the answer is that no tracking is set up. You must supply the remote-tracking-branch on the command line with the --track option to git branch. Actually I realized that with a new enough version of Git, --track is implied. > ? 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? It's not a problem, you could just add an appropriate [branch...] section in your .git/config. Actually looking at a typical branch section is even more confusing to me: $ git branch fudge origin/fix1 adds this to the .git/config: [branch "fudge"] remote = origin merge = refs/heads/fix1 The config file does not record the remote-tracking-branch, instead it explicitly records the remote repository information. So it sure appears that if you add the --track option, it _does_ make the local branch track a remote directly. Thus it's hard to call it anything but what you labelled it, a local tracking-branch. While I thought i had a handle on this, i'm now officially more confused than you; hopefully someone with knowledge of the guts of Git will speak up. Junio Help! Sean