{"thread":{"id":"61706","subject":"How to set a default/fallback upstream for new branches?","startedAt":"2024-06-30T11:16:48Z","lastAt":"2024-06-30T11:16:48Z","messageCount":1,"participants":["Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"497854","messageId":"CACPtaxbxZV+DPAboY5ijo6AjbsbQm8ep8twM_Ai18F+OG-bDmw@mail.gmail.com","threadId":"61706","inReplyTo":null,"subject":"How to set a default/fallback upstream for new branches?","fromName":"Björn Steinbrink","fromEmail":"bsteinbr@gmail.com","sentAt":"2024-06-30T11:16:34Z","receivedAt":"2024-06-30T11:16:48Z","isPatch":false,"sender":{"key":"bsteinbr@gmail.com","avatar":null},"body":"Hi folks,\n\nMy current git workflow is to have a central repo with a master/main branch\nthat receives pull requests and I create my feature branches with that branch,\ni.e. origin/HEAD, as their upstream. I push using `git push origin HEAD`, using\n`--force-with-lease` when necessary due to rebasing.\n\nThat way pull/push do exactly what I want. I can update my commit series\nagainst upstream development on the main branch and update/replace the feature\nbranch on the central version with my updated version of it.\n\nTo have the upstream for new branches set up automatically, I have\nautoSetupMerge set to \"inherit\". This works most of the time to get the\nupstream of a new branch set up correctly.  But sometimes I need to work on a\nfeature branch that exists in the central repo, for which I have no local\nbranch head yet, e.g. because I took over from someone else. In that case,\n\"git checkout foo\" will not find any upstream to inherit:\n\n    $ git checkout foo\n    warning: asked to inherit tracking from 'refs/remotes/origin/foo',\nbut no remote is set\n    Switched to a new branch 'foo'\n\nIn that situation, I'd like it to fall back to a default value like\n`origin/HEAD`.\n\nIs there a way to do that?\n\nCheers,\nBjörn\n"}]}