Re: setting up tracking on push
- From
Jay Soffian <jaysoffian@gmail.com>
- Date
- Mar 12, 2009, 01:21 UTC
- Message-ID
- <76718490903111821u1323361m1e251564332c9b06@mail.gmail.com>
- In-Reply-To
- <76718490903111814t1ab90a39h9252d0ccf8af05c4@mail.gmail.com>
On Wed, Mar 11, 2009 at 9:14 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
Show 13 quoted lines
> - Local branches can be associated with remote tracking branches in > the repo's config (.git/config). This association is done > automatically in current git when creating a new local branch based on > a remote tracking branch (e.g, git checkout -b topic origin/master or > git branch topic origin/master). (You can use --track and --no-track > to be explicit about whether or not you want the association to > happen.) > > The association itself is simply an entry in the repo's .git/config. e.g.: > > [branch "topic"] > remote = origin > merge = refs/heads/master
As Junio points out, a local branch can be associated with another local branch, not just a remote-tracking branch. In the config, this looks like:
[branch "topic"]
remote = .
merge = refs/heads/masterSo now "topic" is associated with *local* branch master, not remote-tracking branch master, and this is because "remote = ." means "this repo right here".
But, when making a new branch based on a local branch via git branch and git checkout, adding this association in the config is not the default. You have to explicitly ask for it with --track.
Also, the default of whether or not to add the association can itself be changed. See the entry for branch.autosetupmerge (and related branch.autosetuprebase, which I didn't go into) in "git help config".
j.