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

PR #2 was based on PR #1's branch, and #1 has just been merged. What happens to #2?

IntermediateScenarioRemotes, Collaboration and Pull Requests
Answer

Situation read → PR #2's base branch may disappear, so GitHub must decide where it points.

What I'd do →

  1. If "delete branch on merge" is on, GitHub retargets #2 to the base of #1 (usually main).
  2. If #1 was squashed, rebase: git rebase --onto origin/main <old-#1-tip> feature-2.
  3. Force-push with lease and check the diff only contains #2's changes.
  4. Re-run CI.

Why → Without the rebase, the squash commit and the original commits both look like changes.

Interview tip → Merge strategy affects stacked workflows; say that out loud.

All Git & GitHub questions Roadmap: Git & GitHub

More on Remotes, Collaboration and Pull Requests