Interview Prep/Git & GitHub/Remotes, Collaboration and Pull Requests

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 →

  1. Branch chain: feat-1 from main, feat-2 from feat-1, feat-3 from feat-2.
  2. PR bases: feat-1 → main, feat-2 → feat-1, feat-3 → feat-2.
  3. Merge bottom-up. When the base branch is deleted after merging, GitHub retargets the next PR to main.
  4. Rebase upstream branches with git rebase --update-refs after changes or squash merges.
  5. 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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests