Git, CI/CD & GitOpsXXX · Pull Requests and Merge RequestsReview
The diff and the review — what reviewers look at and why small PRs matter
What you'll learn
- Distinguish the two-dot diff from the three-dot diff
- Identify the four things a reviewer is checking — correctness, side-effects, reversibility, and intent
- Recognise the cognitive cost of large PRs and the production consequences of review-by-rubber-stamp
- Apply the small-PR discipline to infrastructure changes
Prerequisites
Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x
The diff is the artefact the reviewer reads. Four questions: Is this correct? What are the side-effects? Can it be reversed? Does the intent match the change? Each has a cognitive cost that grows non-linearly with PR size. A 50-line diff is reviewed carefully. A 5,000-line diff is rubber-stamped.
Two-dot and three-dot
The two-dot diff shows what is on the head branch but not on the base; the three-dot diff shows what is on the head since the merge base. For an infrastructure team, the distinction matters: a PR with a stale base ref will look much bigger in the two-dot view because main has been advancing while the branch was open.
git diff main..feature/login-v2
git diff main...feature/login-v2
If main advanced by ten commits after the branch forked, the two-dot diff includes those ten commits plus the branch’s own — a misleading view that mixes “what I changed” with “what other people changed”. The three-dot range isolates the branch’s own contribution since the merge base, which is the reviewer’s actual scope.
flowchart LR
H["feature/login-v2"] --> C1["commit a"]
C1 --> C2["commit b"]
C2 --> C3["commit c"]
M["merge base"] --> C1
B["main tip"] --> X1["main commit 1"]
X1 --> X2["main commit 2"]
X2 --> B
M --> X1
A["main..feature (2-dot)"] -. "includes a,b,c and 1,2" .-> H
B["main...feature (3-dot)"] -. "includes only a,b,c" .-> H
git request-pull origin/main git@github.com:team/repo.git feature/login-v2
git request-pull produces a paste-able summary — commits, diffstat, fetch URL. The web UI of every modern forge defaults to the three-dot view for the same reason.
What reviewers actually look at
A reviewer of an infrastructure change is checking four things:
- Correctness. Does the change do what the description says?
- Side-effects. What else does this touch? A Terraform IAM attachment asks: what does this policy grant, to whom, and is the principal scoped tightly enough? Side-effects are where most production incidents enter through an infrastructure PR.
- Reversibility. A new resource is trivially reversible; a state-altering change or credential rotation is much harder.
- Intent. Does the description match the change? “bump timeout” that rewrites a routing table is a smell.
Production discipline
- Three-dot diff is the review surface. Flag PRs that include main-line changes.
- PR size budget. Small if it changes fewer than ~400 lines including tests; otherwise split.
- One thing per PR. Refactor, feature, and fix are three PRs.
- Review side-effects, not just the diff. A reviewer who has not run the plan has not reviewed a Terraform change.
Cross-course references
- CI/CD Pipeline Patterns - Part III (FastCI): PR size and CI runtime.
- Terraform for Production Sysadmins - Part XI (PRWorkflows): the small-PR discipline for Terraform.
- Ansible for Production Sysadmins - Part XXXVIII (ReviewPatterns): review patterns for playbooks.
Quiz
Knowledge check · 4 questions
Q1. A reviewer wants only the changes the branch introduces, not changes from main after the branch forked. Which diff range should they use?
Q2. The cognitive cost of reviewing a PR grows linearly with PR size.
Q3. Name the four questions a reviewer of an infrastructure PR is answering.
Q4. Diagnose review-by-rubber-stamp in a team shipping infrastructure changes uncaught.
An infrastructure team reviews PRs in batches. The median PR size is 1,800 lines. Approvals take four minutes on average. Last quarter a misconfigured IAM policy was merged because the reviewer approved without reading; the policy granted s3:* on a production bucket. Audit asks why the review process did not catch it.
Passing score: 75%. Answers are checked in this browser.