How to set a default/fallback upstream for new branches?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

My current git workflow is to have a central repo with a master/main branch
that receives pull requests and I create my feature branches with that branch,
i.e. origin/HEAD, as their upstream. I push using `git push origin HEAD`, using
`--force-with-lease` when necessary due to rebasing.

That way pull/push do exactly what I want. I can update my commit series
against upstream development on the main branch and update/replace the feature
branch on the central version with my updated version of it.

To have the upstream for new branches set up automatically, I have
autoSetupMerge set to "inherit". This works most of the time to get the
upstream of a new branch set up correctly.  But sometimes I need to work on a
feature branch that exists in the central repo, for which I have no local
branch head yet, e.g. because I took over from someone else. In that case,
"git checkout foo" will not find any upstream to inherit:

    $ git checkout foo
    warning: asked to inherit tracking from 'refs/remotes/origin/foo',
but no remote is set
    Switched to a new branch 'foo'

In that situation, I'd like it to fall back to a default value like
`origin/HEAD`.

Is there a way to do that?

Cheers,
Björn





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux