| ▲ | tomasreimers 5 days ago |
| Just taking a step back, it is SO COOL to me to be reading about stacked pull requests on HN. When we started graphite.dev years ago that was a workflow most developers had never heard of unless they had previously been at FB / Google. Fun to see how fast code review can change over 3-4yrs :) |
|
| ▲ | benreesman 5 days ago | parent | next [-] |
| I'm a pre-mercurial arcanist refugee who tends to promote Graphite in teams that are still struggling with mega-PRs and merge commits and other own goal GitHub-isms. Big fan in general even with the somewhat rocky scaling road we've been on :) And I very much appreciate both the ambition and results that come from making it interop with PRs, its a nightmare problem and its pretty damned amazing it works at all, let alone most of the time. I would strongly lobby for a prescriptive mode where Graphite initializes a repository with hardcore settings that would allow it to make more assumptions about the underlying repo (merge commits, you know the list better than I do). I think that's what could let it be bulletproof. |
| |
| ▲ | tomasreimers 5 days ago | parent [-] | | We've talked about a "safe mode" where we initialize it similar to JJ - such that you can no longer directly run git commands without funneling them thru graphite, but which would make it bulletproof. Would that be interesting? | | |
| ▲ | benreesman 5 days ago | parent [-] | | I think jujitsu is interesting it it's own right! It seems non-obvious that you would have to prohibit git commands in general, they're already "buyer beware" with the current tool (and arcanist for that matter). Certainly a "strict mode" where only well-behaved trees could interact with the tool creates scope for all kinds of performance and robustness optimizations (and with reflog bisecting it could even tell you where you went off script). I was more referring to the compromises that gt has to make to cope with arbitrary GitHub PRs seem a lot more fiddly than directly invoking git, but that's your area of expertise and my anecdote! Broad strokes I'm excited for the inevitable decoupling of gt from GitHub per se, it was clearly existential for zero to one, but you folks are a first order surface in 2025. Keep it up! |
|
|
|
| ▲ | m11a 5 days ago | parent | prev | next [-] |
| Graphite seems cool, it’s just unfortunately quite expensive and sometimes hard to convince procurement/etc to invest in when it has a noticeable cost involved. So I’m really hoping something like Graphite becomes open-source, or integrated into GitHub. |
| |
|
| ▲ | mytailorisrich 5 days ago | parent | prev | next [-] |
| Stacked pull requests seem to add a layer of complexity to solve a problem that should and can be avoided in the first place. Frequent, small changes are really a good practice. Then we have things like trunk-based development and continuous integration. |
| |
| ▲ | vlovich123 4 days ago | parent | next [-] | | I’m confused. How do you do frequent small changes and avoid stacked PRs. Do you just do a small commit, wait for a review, merge, do another small commit? Or do you make a bunch of small commits locally and only put up the next one for review when the previous one is reviewed and merged? That’s the only models I can think of and it’s weird to advocate to have a variable time asynchronous process in the middle of your code or review loops. Seems like you’re just handicapping your velocity for no reason. Stacked PRs are precisely about factoring out small changes into individually reviewable commits that can be reviewed and landed independently, decoupling reviewer and developer while retaining good properties like small commits that the reviewer is going to do a better job on, larger single purpose commits that the reviewer knows to spend more time on without getting overwhelmed dealing with unrelated noise, and the ability to see relationships between smaller commits and the bigger picture. Meanwhile the developer gets to land unobtrusive cleanups that serve a broader goal faster to avoid merge conflicts while getting feedback quicker on work while working towards a larger goal. The only time stacked commits aren’t as useful is for junior devs who cants organize themselves well enough to understand how to do this well (it’s an art you have to intentionally practice at) and don’t generally have a good handle on the broader scope of what they’re working towards. | | |
| ▲ | jacques_chester 4 days ago | parent [-] | | Trunk-based development, by itself, is a fool's errand. But combine it with TDD & pairing and it becomes a license to deliver robust features at warp speed. | | |
| ▲ | vlovich123 4 days ago | parent [-] | | I don’t follow. Regardless of where you merge, are you not developing features on a shared branch with others? Or do you just have a single long development branch and then merge once “you’re done” and hope that there’s no merge conflicts? But regardless, I’m missing how reviews are being done. |
|
| |
| ▲ | johnmaguire 5 days ago | parent | prev [-] | | Stacked PRs allow me to post frequent, small changes without waiting for a review between each one. | | |
| ▲ | mytailorisrich 5 days ago | parent [-] | | Well, you don't need stacked PRs for that... I think stacked PRs are a symptoms of the issues the underlying workflow (feature branches with blocking reviews) has. | | |
| ▲ | ncruces 5 days ago | parent | next [-] | | “What you'll do next and in what way” is often an important tool to put the small changes into context. Stacked pull requests can be an important tool to enable “frequent, small changes” IMO. Sure, I can use a single pull request and a branch on top of that, but then it's harder for others to leave notes on the future, WIP, steps. A common situation is that during code review I create a few alternative WIP changes to communicate to a reviewer how I might resolve a comment; they can do the same, and share it with me. Discussion can fork to those change sets. Gerrit is much closer to my desired workflow than GitHub PRs. | | |
| ▲ | mytailorisrich 5 days ago | parent [-] | | From a continuous integration perspective my understanding is that stacked pulled requests do not make change more frequent if we define a "change" as being committed on the master branch. They only split the feature branch into smaller chunks. On the other hand, I do take your point about context over a number of consecutive changes. But, to me, "creating a few alternative WIP changes to communicate to a reviewer" indicates an issue with code reviews. I don't think code reviews are the time to propose alternative implementations, even if you have a "better" idea unless the code under review is broken. | | |
| ▲ | gen220 4 days ago | parent | next [-] | | FWIW, stacking is "just a tool" that you can use to make whatever sort of workflow you want. I agree creating alt PRs isn't a high-value usage of the tools. The //actually better// workflows stacking enables are the same sort of workflows that `git add -p`, `git commit --fixup` and `git rebase` enable, just at a higher level of abstraction (PRs vs commits). You can "merge as a stack" as you imply, but you can also merge in sub-chunks, or make a base 2-3 PRs in a stack that 4 other stacks build on top of. It allows you to confidently author the N+1th piece of work that you'd normally "defer" doing until after everything up to N has been reviewed. An example: I add a feature flag, implement a divergent behavior behind a feature flag gate, delete the feature flag and remove the old behavior. I can do this in one "stack", in which I deploy the first two today and the last one next week. I don't have to "come back" to this part of the codebase a week from now to implement removing the flag, I can just merge the last PR that I wrote while I had full context on this corner. In theory you can do all of this stuff with vanilla git and GitHub. In non-stacking orgs, I'd regularly be the only person doing this, because I was the only one comfortable enough with git (and stacking) for it to not be toooo big a burden to my workflow. Graphite (and other stacking tools) make this workflow more accessible and intuitive to people, which is a big net win for reviewers imo. | |
| ▲ | vlovich123 4 days ago | parent | prev [-] | | > From a continuous integration perspective my understanding is that stacked pulled requests do not make change more frequent if we define a "change" as being committed on the master branch Empirically this is not true if you also control for review quality. If your code review is a rubber stamp then sure mega PRs win because you put up a PR and then merge. But why review then? However, code review quality goes up when you break things down into smaller commits because the code reviewer can sanity check a refactor without going over each line (pattern matching) while spending more time on other PRs that do other things. And if you are breaking things down, then stacked PRs are definitely faster at merged to master/unit of time. I introduced graphite to my team and whereas before we struggled to land a broken down PR of ~5 commits in one week, we’d regularly land ~10+ commit stacks every few days because most of the changes of a larger body of work got approved and merged (since often times the commit order isn’t even important, you can reorder the small commits), conditional approvals (ie cleanups needed) didn’t require further follow ups from the reviewer, and longer discussion PRs could stay open for longer without blocking progress and both developer and reviewer could focus their attention there. Additionally, graphite is good about automatically merging a group of approved small individual commits from a larger set of changes automatically without you babysitting which is infinitely easier than managing this in GitHub and merging 1 commit, rebasing other PRs after a merge etc. |
|
| |
| ▲ | vlovich123 4 days ago | parent | prev [-] | | What’s your counter proposal on the workflow? No code reviews? |
|
|
|
|
| ▲ | foota 5 days ago | parent | prev | next [-] |
| I miss the fig workflow :-( |
| |
| ▲ | kyrra 5 days ago | parent [-] | | Try `jj`, as others have mentioned. It's being built by the team that built/maintains fig, and the are porting all their learnings into that. | | |
| ▲ | ndr 5 days ago | parent [-] | | jj is cool solo, but it doesn't seem of much help when maintaining a stack of PRs neatly updated on github | | |
| ▲ | abound 4 days ago | parent [-] | | It requires a bit of scripting between the `gh` CLI and `jj`, but it's totally doable to maintain even complex stacks of PRs on GitHub with jj. One thing I've found at $DAYJOB is that I have to set the PR's "base" branch to "main" before I push updated commits (and then switch it back to the parent after), otherwise CI thinks my PR contains everything on main and goes nuts emailing half the company to come review it. | | |
| ▲ | ndr 4 days ago | parent [-] | | Is there something that does this? I've played with git town which is great for what it is. But at $DAYJOB we are now all on graphite and that stacking is super neat. The web part is frustratingly slow, but they got stacking working really well. | | |
| ▲ | jacobegold 4 days ago | parent [-] | | we have a big effort in the works to improve web perf! where specifically are you seeing slowness in the app — what flows, what pages, etc? | | |
| ▲ | ndr 2 days ago | parent [-] | | Super glad to hear! The worst offender is a slack notification[0] deep link into a PR I need to review. It loads in stages, and the time from click to first diff is often so frustratingly long that I end up copying the PR ID and going to GitHub instead. Sometimes I give up while Graphite is still loading and use the shortcut C-G to go to GitHub. The second issue might be the landing page. I love what it shows compared to GitHub, but it's often slow to display loading blocks for things that haven’t even changed. Reloads are usually fast after that — until sometime later, maybe a day, when it slows down again. I don't know why it feels worse than Linear, even though there are clearly many similarities in how it's supposed to load. The guest instance isn’t so much about loading speed, but usage speed. When I submit a stack of PRs, I get a nice carousel to fill in PR titles/descriptions and choose where to publish each PR.
What’s missing for me there is access to files and diffs, so I can re-review before publishing. I often end up closing it and going back to the PR list instead. [0] Thank God for those! You've made them much more useful than GitHub's. Also, the landing page is far more helpful in terms of what’s displayed. |
|
|
|
|
|
|
|
| ▲ | thinkindie 5 days ago | parent | prev | next [-] |
| Given the security incident that happened to CodeRabbit I’m a bit less enthusiastic about testing out new tools that have LLMs and my codebase under the same tool. What can be a very nice experiment to try something new can easily become a security headache to deal with. |
| |
| ▲ | vlovich123 4 days ago | parent [-] | | I don’t understand. By LLMs you’re referring to the optional LLM review graphite offers as an additional purchase on product? I’m not sure I understand the risk concern. |
|
|
| ▲ | globular-toast 5 days ago | parent | prev | next [-] |
| As someone who already breaks tasks into atomic (or near atomic) pieces and always has done, is this just submitting a PR for each commit as you go? How does it work for breaking changes? Requires use of feature flags? |
| |
| ▲ | gen220 4 days ago | parent [-] | | Sort of, yeah! It lends itself well to a 1 PR = 1 commit philosophy. Every PR has to pass CI to be mergeable. If you want to make a CI-breaking change, putting that behind a feature flag is one valid strategy. I'd recommend giving it a try to see what it's like. The `gt`/onboarding tour is pretty edifying and brief. It's likely that you'll find that `gt` is "enabling" workflows that you've already found efficient solutions for, because it's essentially an opinionated and productive subset of git+github. But it comes with some guardrails and bells and whistles that makes it both (1) easier for devs who are new to trunk-based dev to grok and (2) easier for seasoned devs to do essentially the same work they were already doing with fewer clicks and less `git`-fu. |
|
|
| ▲ | vinnymac 5 days ago | parent | prev | next [-] |
| Just signed up, looks like everything I ever wanted |
|
| ▲ | paulddraper 5 days ago | parent | prev | next [-] |
| Dude, I love Graphite. Best AI code review, hands down. (And I’ve tried a few.) |
|
| ▲ | jacobegold 5 days ago | parent | prev [-] |
| hell yeah |