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

Re: Best "triangle" workflow setup?

From
Jeff King <peff@peff.net>
Date
May 13, 2017, 06:43 UTC
Message-ID
<20170513064348.wwnkle4bkhih2clx@sigill.intra.peff.net>
In-Reply-To
<CAHd499A=wwxFxZ2mq=PZcOBNRSiK1Xm_sE79AypBXQaYU_UcJQ@mail.gmail.com>
On Fri, May 12, 2017 at 09:53:23AM -0500, Robert Dailey wrote:
> Thanks, just curious, where in the git documentation is the "origin"
> to "origin/HEAD" resolution documented? I checked the git-revisions
> page but it doesn't seem to mention it there. Thanks for explaining
> though.
In gitrevisions(7), the <refname> section, rule 6:
  otherwise, refs/remotes/<refname>/HEAD if it exists.

And then the contents of origin/HEAD are discussed a bit in git-remote(1), under set-head.

Show 7 quoted lines
> Also is there a similar mechanism for "track same-named branch on
> specified remote"? Something like "origin/."? I follow git-flow
> development process, so topic branches on hotfix or release branches
> will track origin/master (since origin/HEAD still points to master or
> develop). But I want to track "origin/release/1.2.3" without typing
> the full thing. Basically would be nice if there was a lazy shorthand
> for it similar to the "origin/HEAD" example you gave.

No, I don't think there's a shorthand for "the same-named branch". But there are two things that might help:

  1. If you're always branching from release/1.2.3 instead of "master",
     you can use "git remote set-head" to change it.
  2. If you want a local branch "foo" to track refs/remotes/origin/foo
     (which already exists) then the checkout-dwim should work for you:
        $ git checkout foo
	Branch foo set up to track remote branch foo from origin.
	Switched to a new branch 'foo'
-Peff
Previous: Robert Dailey
Message 6 of 6 in “Best "triangle" workflow setup?”
  1. Robert DaileyMay 11, 2017
  2. Jeff KingMay 11, 2017
  3. Robert DaileyMay 11, 2017
  4. Jeff KingMay 11, 2017
  5. Robert DaileyMay 12, 2017
  6. Jeff KingMay 13, 2017

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.