Your team wants stacked PRs so that large work arrives in small reviewable steps. How do you set it up?
AdvancedScenarioRemotes, Collaboration and Pull Requests
Answer
Situation read → Each PR depends on the one below, so base branches and merge order matter.
What I'd do →
- Branch chain:
feat-1frommain,feat-2fromfeat-1,feat-3fromfeat-2. - PR bases:
feat-1 → main,feat-2 → feat-1,feat-3 → feat-2. - Merge bottom-up. When the base branch is deleted after merging, GitHub retargets the next PR to
main. - Rebase upstream branches with
git rebase --update-refsafter changes or squash merges. - Consider tooling (Graphite, ghstack, git-branchless) when stacks are common.
Why → Reviewers see only a small diff per PR, even though the work is large.
Interview tip → Squash merging forces rebase --onto for the next layer, so mention it.
More on Remotes, Collaboration and Pull Requests
You are new to a team. How do you collaborate daily without stepping on others' toes?BeginnerYou are migrating a repo from Bitbucket to GitHub and must keep every branch and tag.IntermediateYou want to contribute a fix to an open-source project you do not have write access to.BeginnerA teammate sent a 3,000-line PR and nobody can review it properly.IntermediateA reviewer asks for changes. How do you update the PR cleanly?BeginnerWhy do you use `--force-with-lease`, and when does it still hurt?Intermediate