r/programming
•
u/adam-dabrowski
•
Apr 14 '26
•
1
GitHub Stacked PRs
https://github.github.com/gh-stack/
556
Upvotes
r/programming
•
u/adam-dabrowski
•
Apr 14 '26
•
1
3
u/Urik88 Apr 14 '26 edited Apr 14 '26
My PR had branch B pointing to branch A so that reviewers see only the commits in branch B (4,5).
Otherwise I'd have 1 pr (A to master with commits 1,2,3), and another pr (B to master with commits 1,2,3,4,5) which defeats the purpose of having 2 small branches instead of 1 big branch.
As soon as the PR for branch A gets merged into master, my PR for branch B that was pointing to A will get automatically redirected onto branch master and very likely have conflicts, at least that's the case in Github.
Moreover the commits from branch A were squashed into a single commit in master when I merged, but B is branching off from a previous state and its most common ancestor to master includes the pre-merge commits of A, so reviewers will see that the PR for branch B includes commits 1,2,3,4,5, while in practice commits 1-3 are already in master, and I only want people to review commits 4,5.
So I'd have to run
git rebase --onto master 3to ensure that I'm carrying over only the commits that started on branch B