Interview Prep/Git & GitHub/Branching strategies, pull requests and code review

What are stacked PRs and how do you manage them in Git?

IntermediateConceptBranching strategies, pull requests and code review
Answer

A chain of dependent PRs, each branching from the previous, so a large change is reviewed in small pieces. In Git you rebase the stack when a lower PR changes (git rebase --onto, --update-refs in Git 2.38+), and tools like Graphite, ghstack or git-branchless automate it.

git rebase --update-refs origin/main
All Git & GitHub questions Roadmap: Git & GitHub

More on Branching strategies, pull requests and code review