Stacked diffs with Maiao
4 points by kqr
4 points by kqr
Honestly surprised that the post does not mention Jujutsu.
Any time I read about Jujutsu I think, "Ah yeah, I can see how that would be attractive when you're stuck with command-line git, but I'm using Magit which solves the same problem in a way I'm familiar with and which teaches me git internals at the same time".
I'm open to trying it, but I haven't found a good enough reason to yet. Hence why I can't say anything about it.
As a heavy magit user, I have the exact same reaction, every time. I have my pain points with git, but magit solves most of them, and the cost of using a completely different interface is just too high as it is.
I am a big fan of Magit too but, honestly, I wouldn’t say it covers everything jj does. I used to think that, but it was mostly because I wasn’t really using jj and, so to say, I didn’t know what I didn’t know.
Commit splitting with Magit is pretty nice (almost as easy as jj split). But Magit's equivalent of jj absorb isn’t nearly as seamless. If you ever tried jj arrange, you would agree that nothing in Magit comes even close. A workflow like Megamerge, which needs creating commits in the middle of already-merged branches, are trivial in jj and still a bit intimidating in Magit.
Best of jj and Magit: one can have both, with Majutsu.
I would love to use Stacked PRs more, and this seems like a nice tool.
But in reality when I'm working my problem isn't so much "how do I move these nicely separated changes to a forge", but more "how do I nicely separate my changes in the first place".
I work through a problem, then halfway through that notice that I need to refactor something. Or find a bug in a test. Or notice that my build script has a mistake in it. Et cetera. Sometimes this is after I've been working on the change for a while and made a bunch of commits already, and I start noticing that the thing I thought was going to be simple would benefit from stacking some PRs.
Can anyone suggest me a good tool (preferably a GUI or TUI) or workflow, to help me organize a messy change into a set of independent commits? I think I'd want to be able to move changes at the hunk level, whole files is a start but when I'm working through a large change some small fixes in a larger file may just go into their own "uncontentious" little PR that can be shipped quickly.
How deep do your stacks get before review becomes the limit? I cap my open PRs… One PR per commit looks like a quick way to blow through a cap like that.
I've gone up to 10 commits in a stack that were reviewed reasonably quickly and addressing feedback when paired with git-absorb was pretty painless. I do see the value of self enforcing a cap but I've never had a bandwidth problem in the 2 or so years I've been using stacked diffs at work.
I'm a big fan of WIP limits, but I haven't had a need to actively enforce them for pull requests. I'm so used to only having a few PRs ongoing at a time that I'm naturally inclined to close the ones that are open over creating new ones.
My stacks are normally 1–4 commits deep. Sometimes when I make a bug fixing push I can get stacks up to 12 commits deep, but then all commits are very small. (Once I did get up to 20 commits, but that was too much for me, even when they were individually small, so I avoid that now. Though not out of a hard limit, just by aiming lower.)
(It's a different story with my partially-ongoing side project count. It's gone up significantly due to the lower starting cost when using language model agents. I'm still not sure how to handle that, but I think "don't use this newfound ability to explore wider" is the wrong choice. We're all learning to adapt.)