Covers the four habits of a reviewable pull request: small focused size, a description that explains why, tests that prove the change, and a self-review before asking anyone else.
A good pull request is one a reviewer can understand, verify and approve in one sitting.
The trade-off: splitting work into small PRs costs the author a little planning time, but it saves reviewers far more and gets the change merged sooner.
"A good pull request is one a reviewer can understand, check and approve in one sitting, so I optimise for the reviewer's time. The first thing is size. I keep a PR to one purpose, usually under about 400 changed lines, because studies of code review and my own experience both show that defect-finding drops off badly after that: people skim a 2,000-line diff and approve it. If I renamed a class and also changed pricing logic, that's two PRs, or at least two commits, so the rename doesn't hide the real change.
The second thing is the description. The diff already shows what changed; the description has to say why. I write the problem, the approach and the alternatives I rejected, how I tested it, and anything risky like a migration or a feature flag. I link the ticket, and for UI or API changes I add a screenshot or a sample request and response. Then tests: the PR includes the tests that prove the behaviour, and CI is green before I request review, because asking someone to review red code wastes their time.
Finally, self-review. Before I add reviewers I read my own diff in the PR tool, top to bottom, as if someone else wrote it. I nearly always find something: a leftover
Console.WriteLine, a commented-out block, a file I didn't mean to commit, a vague name. The mistake I see is people treating review as the place to find their own sloppiness. A PR should be a request for a second opinion, not a request for someone to finish your work."
| Part | What good looks like | Why it matters |
|---|---|---|
| Size | One purpose, ~50–400 changed lines | Reviewers find more defects in small diffs and respond faster |
| Description | Why, what, how tested, risk, ticket link | The reviewer can judge the approach, not just the syntax |
| Tests | New behaviour covered; CI green | Proof the change works; protects it from the next change |
| Self-review | Diff read once by the author first | Catches the cheap problems before they cost someone else's time |
| Section | Example |
|---|---|
| Why | Invoices for GST-free items were taxed at 10% (bug #1423) |
| What | TaxCalculator now reads the item's tax code; added TaxCode.GstFree |
| How tested | Unit tests for each tax code; ran the invoice export against the test tenant |
| Risk / rollout | No migration. Behind invoice-tax-codes flag, off by default |
| Technique | When it fits |
|---|---|
| Separate refactoring PR first | You need to reshape code before the real change |
| Feature flag | The feature is too big for one PR but each slice can merge safely |
| Stacked PRs | Changes depend on each other; each is reviewed on its own |
| Draft PR | You want early feedback on the approach before polishing |
On a team of eight, PRs averaged about 900 changed lines and took around three days to merge. After agreeing on a soft 400-line limit and a description template, the median dropped to about 180 lines and time to merge fell to under a day, with fewer post-merge bug fixes because reviewers were actually reading the diffs.
Checks whether the candidate thinks about the reviewer and the team, not just about getting their own code merged.
Green flags
Red flags
Review is a human reading task with limited attention. Research on code review at large companies (Cisco's SmartBear study is the classic one) found that reviewers find most defects in the first 200–400 lines and the first hour; past that, the defect-detection rate falls off. A large diff also hides risky lines among trivial ones.
Changed lines Typical reviewer behaviour
< 100 reads every line, asks questions
100 - 400 reads carefully, maybe in two passes
400 - 1000 skims, focuses on files they know
> 1000 "LGTM" after scrolling
The diff shows lines; it doesn't show intent, rejected alternatives, test evidence or rollout risk. Without those, reviewers either guess or ask, and every question costs a round trip (often hours across time zones). A good description front-loads the answers.
A rename across 40 files plus a two-line logic change produces a 300-line diff where the two important lines are invisible. Split it:
PR 1: Rename OrderSvc -> OrderService (mechanical, approved quickly)
PR 2: Fix discount rounding (12 lines, reviewed carefully)
If you can't split into PRs, split into commits and say "review commit by commit" in the description.
Tests belong in the same PR as the behaviour. They prove the change works today and stop the next change from silently breaking it. Reviewers can read the tests first as an executable specification.
Reading your diff in GitHub or Azure DevOps (not your IDE) shows you exactly what the reviewer sees. Common catches: debug output, // TODO notes you meant to resolve, secrets in appsettings.Development.json, generated files, unrelated whitespace churn from a different formatter.
Let tools handle style and simple rules: dotnet format --verify-no-changes, analysers with warnings as errors, a PR template, and branch protection that requires green CI. Humans then spend their review on design, correctness and naming.
.github/pull_request_template.md with Why / What / How tested / Risk.git log --stat on a feature branch and split one mixed commit with git add -p.dotnet format --verify-no-changes to CI so formatting never appears in review comments.A PR template the team keeps in the repository, so every description answers the same questions.
<!-- .github/pull_request_template.md -->
## Why
<!-- The problem or ticket. Link it: AB#1423 -->
## What changed
<!-- The approach, and any alternative you rejected -->
## How I tested it
- [ ] Unit tests added or updated
- [ ] Ran locally against the test tenant
## Risk and rollout
<!-- Migration? Feature flag? Anything to watch after deploy? -->
## Self-review
- [ ] I read my own diff in the browser
- [ ] No debug code, commented-out code or unrelated changes
A small, focused change with its test in the same PR (before and after):
// Before: GST applied to every line, including GST-free items.
namespace Billing;
public sealed class TaxCalculator
{
public decimal TaxFor(InvoiceLine line) => Math.Round(line.Net * 0.10m, 2);
}
// After: the tax code decides the rate. One reason to change, one test file.
namespace Billing;
public enum TaxCode { Standard, GstFree }
public sealed record InvoiceLine(string Sku, decimal Net, TaxCode TaxCode);
public sealed class TaxCalculator
{
private const decimal GstRate = 0.10m;
public decimal TaxFor(InvoiceLine line) => line.TaxCode switch
{
TaxCode.GstFree => 0m,
_ => Math.Round(line.Net * GstRate, 2, MidpointRounding.AwayFromZero)
};
}
public sealed class TaxCalculatorTests
{
[Theory]
[InlineData(TaxCode.Standard, 100.00, 10.00)]
[InlineData(TaxCode.GstFree, 100.00, 0.00)]
public void Tax_depends_on_tax_code(TaxCode code, decimal net, decimal expected) =>
Assert.Equal(expected, new TaxCalculator().TaxFor(new InvoiceLine("SKU-1", net, code)));
}
Small PRs are a team habit, not a personal virtue. They only work if the codebase supports merging incomplete work safely (feature flags, trunk-based development, fast CI). A senior engineer makes that possible, then models it: splitting their own work visibly and saying "this is PR 2 of 4" in the description.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| One PR per feature | Tiny features | Low | Anything over ~400 lines |
| Stacked PRs | Dependent slices | Rebase overhead | Tooling doesn't support it well |
| Feature flag + small PRs | Long-running features | Flag cleanup later | Trivial changes |
| Draft PR | Approach is uncertain | Reviewer time early | The design is already agreed |
Measure it: median PR size, time to first review and time to merge (GitHub Insights, Azure DevOps analytics or a simple script over the API).
Git Flow keeps two long-lived branches, main (released code) and develop (next release), plus feature/*, release/* and hotfix/* branches that merge back in a set order. Trunk-based development has one long-lived branch, main; developers branch for hours or a day or two, open a small pull request and merge behind CI checks, using feature flags to hide unfinished work.
Most teams moved to trunk-based because long-lived branches delay integration: the longer a branch lives, the bigger the merge and the later you find that two changes conflict. Short branches keep main always releasable, which is what continuous delivery needs.
The trade-off: trunk-based asks for good automated tests and flag discipline; Git Flow still suits products that ship numbered versions and patch several releases at once.
Refactoring is changing the internal structure of code without changing its observable behaviour, in small, reversible steps, so it becomes easier to understand and cheaper to change. It is not a rewrite, a bug fix or a new feature: if outputs, side effects or the public contract change, it is no longer a refactoring, and it belongs in a separate commit.
You need tests first because they are the only cheap proof that behaviour didn't change. Where there are none, write characterisation tests that pin down what the code does today, bugs included. Then work in tiny steps: one named refactoring (rename, extract method, move), run the tests, commit.
The trade-off: refactoring spends time now to buy speed later, so do it where you are about to change code, not across the whole codebase.
Good review is about finding real problems and sharing knowledge without slowing the team.
The trade-off is thoroughness against flow: block only on what matters, and approve with comments for the rest.
Last updated 23 Nov 2026.