Re: Triangular workflow
- From
Jeff King <peff@peff.net>
- Date
- Jan 14, 2026, 02:34 UTC
- Message-ID
- <20260114023408.GA858378@coredump.intra.peff.net>
- In-Reply-To
- <20260113230107.16728-1-haraldnordgren@gmail.com>
On Wed, Jan 14, 2026 at 12:01:07AM +0100, Harald Nordgren wrote:
Show 6 quoted lines
> I'm wondering if since you are scripting this anyway, if you really need a > push branch at all? Can't you just as easily switch to doing this in the > script: > > git config push.default upstream > git push github jk/some-topic
I could (and in fact the script names the remote directly already, because you can't pass refspecs without specifying the remote). But I do occasionally push a single branch with a bare "git push". Usually this is the integration branch, when I am trying to trigger CI manually (e.g., when piling hacks on top in order to debug a CI failure ;) ).
So even if I only do it infrequently, it feels weird that a bare "git push" would try to push to the upstream remote (which I don't even have write access to!).
Show 10 quoted lines
> As a note, before I started working on this feature, I don't realize > that there was such a thing as a push branch (i.e. something different from > the tracking branch). So I had the habit of checking out and pushing like > this: > > git branch --set-upstream-to upstream/master > git push origin $(git rev-parse --abbrev-ref HEAD) > > I worked really well for me. The only issue was missing the status info > from my own branch -- which is why I started writing this feature.
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} HEADto compare two iterations of a branch if I know that I haven't pushed. It is a bit of a cheat, because what I really mean is "do a range-diff since the last thing I sent to the list". But if I have just been working on a branch, and I haven't run an integration cycle since then, then I know that the pushed version will match it.
There is also branch.*.pushRemote, but I have not found that useful (for my triangular flow there is always a single repo to push to, not one per branch).
-Peff