Web lists-archives.com

Re: Best "triangle" workflow setup?

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.

> 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'