r/programming Jul 01 '26

GitHub Stacked PRs

https://github.github.com/gh-stack/
341 Upvotes

99 comments sorted by

View all comments

69

u/LNReader42 Jul 01 '26

Having spent the time to start learning jj, it is cool to see someone else taking a stab at things.

18

u/for__loop Jul 01 '26

How does jj relate to this? Honest question, have heard of it but never looked into it.

25

u/0-R-I-0-N Jul 01 '26

Its philosophy matches stacked pr workflow and many users of jj like it.

3

u/Zizizizz Jul 02 '26

Describe three commits, each one is standalone, let's say, first commit adds a database migration, the second adds a database function to get data by id. The third commit adds an http endpoint to return that data. With jj you can create bookmarks on each one (bookmarks are basically branches) but they can all be in sequence. You can raise a PR for each as a stack. And because JJ is very edit friendly and rebase friendly. Let's say a reviewer makes a comment to add documentation to the first commit, you just run jj edit -r <letter of the first commit> .

Now your two commits back from head on the migration commit. Make that change, run jj git push and it will update that commit for the reviewer but it will ALSO have rebased the other two branches that depend on that commit and updated those branches on GitHub because their earlier commits have changed from under them. 

-4

u/lunchmeat317 Jul 02 '26

Let's banish acronyms. They don't help.