โ—€ Playbook index
NO.8.8

๐Ÿ”€ Pull Requests

Updated: 2026-09-11

In one line

When you write code, there are several ways to branch and merge. This chapter tours the main ones.

Whichever you pick, everyone goes through a Pull Request to merge. We'll break down what a PR contains, and how all of this can be enforced with Rulesets.

Branching strategies

How a team organizes branches around PRs. Pick the model that matches your release cadence.

StrategyHow it worksBest for
๐ŸŒฟ GitHub FlowOne main + short-lived feature branches; PR โ†’ merge โ†’ deploy from mainContinuous delivery, most teams
๐ŸŒณ Git Flowmain + long-lived develop, plus feature / release / hotfix branchesScheduled, versioned releases

๐Ÿ’ก Default to GitHub Flow for speed; reach for Git Flow only when you ship versioned releases.

GitHub Flow

One long-lived branch (main), short-lived feature branches. Branch off main, open a PR, review, merge, and deploy โ€” continuously. Simple and fast; ideal for web apps and small teams shipping many times a day.

change main change change
  • ๐ŸŒฟ Branch from main for each change (feature / fix)
  • ๐Ÿ”€ Open a PR early โ€” review and CI run on the branch
  • โœ… Merge to main, then deploy immediately
  • โ™ป๏ธ main stays always deployable

๐Ÿ’ก Fewer moving parts = faster feedback. The default for continuous delivery.

Git Flow

Two long-lived branches (main + develop) plus supporting branches. Work integrates on develop; a release branch stabilizes a version, then merges to main and gets tagged. Structured for scheduled, versioned releases and larger teams.

main hotfix release develop feature feature v0.1 v0.2 v1.0
  • ๐ŸŒณ develop = integration line ยท main = production (tagged)
  • ๐Ÿงฉ feature/* branches off develop, merges back
  • ๐Ÿ“ฆ release/* stabilizes โ†’ merges to main + develop, tags the version
  • ๐Ÿš‘ hotfix/* off main for urgent prod fixes โ†’ merges to both

๐ŸŽฏ More ceremony, more control. Reach for it when you ship versioned releases, not continuous deploys.

Inside a review

Today a PR can be opened by a human, a cloud agent, Dependabot, or an agentic workflow. On the diff, conversation, checks, and automated analysis converge: the place where quality is secured before merge.

ElementRole
๐Ÿ”€ Propose diffCompare branches, request merge
๐Ÿ’ฌ ReviewLine comments, approve/reject
๐Ÿค– Copilot code reviewAI auto-reviews every PR
โœ… Tests / CIRequired status checks must pass
๐Ÿ›ก๏ธ Code Scanning (GHAS ยท Code Security)CodeQL finds security vulnerabilities
๐Ÿ“Š Code Quality (standalone product)Maintainability & reliability analysis (billed separately)

๐Ÿ”‘ Closes #123 in a PR โ†’ the Issue auto-closes on merge.

Rulesets

Rulesets enforce merge conditions as rules, a quality gate on your branches. Configure them at the organization or repository level, and apply them top-down across many repos.

Minimal recommended setup:

RuleRecommended settingWhy
๐Ÿ”€ Require a pull request before mergingON + Required approvals: 1Block direct pushes; every change gets at least one review
๐Ÿ›ก๏ธ Require status checks to passRequire tests + Require branches to be up to date before mergingMerge only when CI is green and validated against the latest main
๐Ÿ” Require code scanning resultsRequire CodeQL results (block by severity)Stop merges while unresolved security alerts remain
๐Ÿ”’ Block force pushesONPrevent destructive history rewrites
๐Ÿค– Automatically request Copilot code reviewONCopilot pre-reviews every PR automatically

๐ŸŽฏ Stop manual gatekeeping; let rulesets enforce top-down.

Stacked pull requests (NEW) ๐Ÿ“– Docs

An ordered chain where each PR targets the branch of the one below it, so reviewers get one small layer at a time instead of a giant diff. Public preview since 2026-07-30.

Merging a stack is one atomic operation. What lands on main depends on the merge method:

feat-c feat-b feat-a main base: feat-b base: feat-a base: main 1 merge commit (PR #1-3)

Branch commits are kept as-is and the whole stack lands through one merge commit. Fullest history.

feat-c feat-b feat-a main base: feat-b base: feat-a base: main PR #1 PR #2 PR #3

Each PR collapses into a single commit on main. Cleanest log, but the individual commits (faded) are lost.

feat-c feat-b feat-a main base: feat-b base: feat-a base: main PR #1 PR #2 PR #3

Every commit is replayed onto main in order. Linear history, no merge commit. The originals (faded) are rewritten.

  • ๐Ÿงฑ Branch protections and CI run on every layer, not just the bottom one
  • ๐Ÿ”„ GitHub rebases for you โ€” merge a lower layer and the ones above retarget automatically
  • โ˜๏ธ Merge one, some, or all: merging the top PR lands the whole stack, always bottom-up
  • ๐Ÿ› ๏ธ github.com, Mobile, REST / GraphQL / webhooks, and gh extension install github/gh-stack

Agent merge (NEW)

In the GitHub Copilot app, hand a pull requestโ€™s last mile to the agent: it clears what is blocking the merge, then merges as soon as GitHub allows.

  • ๐Ÿ”€ Toggle it at the top of a PR โ€” the workspaceโ€™s Copilot session picks it up
  • ๐Ÿฉน Fixes what blocks it: review comments, failing checks, conflicts
  • ๐ŸŒ™ Runs in the background and survives app restarts
  • โœ… Turns itself off once the PR is merged

โš ๏ธ It doesnโ€™t bypass your gates โ€” required approvals and required checks still decide what reaches main.

โ˜… PRs in the AI era

With AI shipping PRs en masse, some ask โ€œare PRs still needed?โ€ But to keep a repo understandable and safe, this gate is necessary.

  • ๐Ÿค– Copilot auto-review catches issues early
  • ๐Ÿ“ˆ ~90M merges/month in 2026 (~2x)
  • ๐Ÿ‘€ Humans approve, AI does the prep

๐Ÿ’ก Guard the PR and go faster = Rulesets ร— Copilot.