Re: Triangular workflow
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Jan 15, 2026, 16:17 UTC
- Message-ID
- <CALnO6CD3Zg_69cPPn+Rh4EKDF-tDQSLJ42YSMJz308=1C8ZQHg@mail.gmail.com>
- In-Reply-To
- <20260114221716.GA1013308@coredump.intra.peff.net>
On Wed, Jan 14, 2026 at 5:17 PM Jeff King <peff@peff.net> wrote:
Show 44 quoted lines
>
> On Wed, Jan 14, 2026 at 04:38:33PM -0500, Ben Knoble wrote:
>
> > > Le 14 janv. 2026 à 11:31, Jeff King <peff@peff.net> a écrit :
> > >
> > >>> Yeah, though @{push} is usually not explicitly configured in the same
> > >>> way @{upstream} is, but rather a consequence of how push.default and
> > >>> remote.pushdefault interact. But it was added for exactly this kind of
> > >>> triangular workflow. I sometimes will do stuff like:
> > >>> git range-diff origin @{push} HEAD
> > >> I imagine the same thing could be achieved with
> > >> origin/$(git rev-parse --abbrev-ref HEAD)
> > >
> > > Sure, but:
> > >
> > > 1. It is a lot shorter to type @{push}. ;)
> > >
> > > 2. Using @{push} works everywhere, even on my non-triangular repos,
> >
> > Just so I’m clear, this is only with push.default=current, right? I could never make @{push} work otherwise.
>
> I always use push.default=current, though I think @{push} should work
> with other modes. E.g., with this setup:
>
> git checkout -b foo
> git clone . tmp
> cd tmp
>
> # for the sake of simplicity, our triangle goes to the same place ;)
> git remote add triangle ..
> git fetch triangle
> git config remote.pushdefault triangle
>
> then doing:
>
> git -c push.default=current rev-parse --symbolic-full-name @{push}
>
> and:
>
> git -c push.default=matching rev-parse --symbolic-full-name @{push}
>
> should both point to refs/remotes/triangle/foo. Using "simple" will not
> work, because it demands that the upstream and the push destination are
> the same (so it doesn't really make sense in a triangular flow at all).Gotcha. Yeah, simple (the default) doesn't work. I suppose upstream might, too. (I also have push.default=current globally, was just wondering about what the minimum was to enabled triangular workflows; see <https://lore.kernel.org/git/CALnO6CAUSU-Pq_r-WYm3o0to6H8MdqiYOuoKaRfL1PTt30VaoQ@mail.gmail.com/>.)
Show 6 quoted lines
> But in a non-triangular flow, it will happily point @{push} to the same
> as @{upstream}. I use a triangular flow for git.git, but most of my
> other repos are just personal projects, and I push/fetch from a single
> central source.
>
> -PeffDitto, yeah (_sometimes_ I actually do the triangle origin/main, local branch, origin/branch, so I almost always set upstream as origin/main anyways). Cool and thanks!
-- D. Ben Knoble