git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Branch relationships

From
JWJosef 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 21 in “git diff: support "-U" and "--unified" options properly”
  1. Linus TorvaldsMay 13, 2006
  2. Junio C HamanoMay 13, 2006
  3. Junio C HamanoMay 13, 2006
  4. Linus TorvaldsMay 13, 2006
  5. Junio C HamanoMay 13, 2006
  6. Linus TorvaldsMay 13, 2006
  7. Junio C HamanoMay 15, 2006
  8. Linus TorvaldsMay 15, 2006
  9. Junio C HamanoMay 15, 2006
  10. Linus TorvaldsMay 15, 2006
  11. Martin LanghoffMay 14, 2006
  12. Josef WeidendorferMay 14, 2006
  13. Junio C HamanoMay 14, 2006
  14. Branch relationships (was:Re: git diff: support "-U" and "--unified" options properly)Josef Weidendorfer, May 14, 2006
  15. Junio C HamanoMay 14, 2006
  16. Josef WeidendorferMay 14, 2006
  17. Junio C HamanoMay 14, 2006
  18. Josef WeidendorferMay 14, 2006
  19. Junio C HamanoMay 14, 2006
  20. Josef WeidendorferMay 15, 2006
  21. Junio C HamanoMay 15, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.