Re: Triangular workflows
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Jan 5, 2026, 22:19 UTC
- Message-ID
- <CALnO6CB7-w0tNMiYn5=SCBow637vRRrKRj_9k1h1DS4crJaVtQ@mail.gmail.com>
- In-Reply-To
- <CAHwyqnWwJuD4T9tuCArW5eY=rPCHKT71LroRRx-aYfDGwr8E9g@mail.gmail.com>
On Thu, Jan 1, 2026 at 2:43 PM Harald Nordgren <haraldnordgren@gmail.com> wrote:
Show 12 quoted lines
> > Hi Ben! > > Did you ever get to this? And does it match what I do in the tests for PATCH v10: > > ``` > git config remote.pushDefault origin > git branch --set-upstream-to upstream/main > ``` > > > Harald
Yeah, that's definitely part of it for me. I've been meaning to write this down elsewhere for a while, but here's what my setup for triangular workflows looks like.
First, there are typically 2 remotes (but not always!). In the examples, I'll use "origin" (the place I usually cloned from first, the most official version of the code, etc.; also the place I pull from) and "benknoble" (the place I push to). The setup works just fine with a single origin, though.
Next, I globally configure
push.default = current
pull.rebase = true
branch.autoSetupRebase = alwaysThe first works with other settings to make the @{push} ref work (and to make "git push" work without arguments). I really like the @{push} ref, and I'm not aware of any other way to enable it.
Then, when setting up a repository I configure remotes and make sure to configure
remote.pushDefault = benknoble
(if there is such a remote).
The next step is usually starting a branch:
git switch -c branch origin # or origin/main, or whatever
With the above settings, I immediately have
- branch@{upstream} (@{u}) -> origin/…
- branch@{push} (@{push}) -> benknoble/branch (or origin/branch,
depending on the case)-- D. Ben Knoble