Re: Branch relationships
- From
- Josef Weidendorfer <josef.weidendorfer@gmx.de>
- Date
- May 14, 2006, 23:04 UTC
- Message-ID
- <200605150104.46762.Josef.Weidendorfer@gmx.de>
- In-Reply-To
- <7v8xp4ntbf.fsf@assigned-by-dhcp.cox.net>
On Monday 15 May 2006 00:19, you wrote:
Show 7 quoted lines
> > I suppose "branch.<branch name>.origin" is still the way to go for > > specifying the upstream? > > Probably "origin" is a better name for it; I was assuming > "branch.<branch name>.remote = foo" refers to a [remote "foo"] > section and means "when on this branch, pull from foo and merge > from it".
Maybe.
But there is a misunderstanding. I wanted the branch attribute "origin" to specify the upstream _branch_, not a remote. After a "git clone", we would have
[remote "origin"] url = ... fetch = master:origin
[branch "master"] origin = "origin" ; upstream of master is local branch "origin"
[branch "origin"] tracksremote ; bool
Now adding a further development branch for remote branch "topic", we would add
[remote "origin"] ... fetch = topic:tracking-topic
[branch "local-topic"] origin = "tracking-topic"
[branch "tracking-topic"] tracksremote
Now, a "git pull" on branch "local-topic" does the right thing: it fetches from remote "origin", as "tracking-topic" is given in a refspec there, and merges "tracking-topic" to the current branch "local-topic", as given by the origin attribute.
This also extends to local upstreams: a "git checkout -b topic2 master" would append
[branch "topic2"] origin = "master"
and a "git pull" on topic2 would merge the upstream "master".
Josef