PRACTITIONERCHAPTER 06

Pull requests that get merged

A pull request is a request for someone's attention, so make it small enough to read in one sitting, say what it is for and how to check it, and shape it for whoever has to approve the release

40 MINSOFTWARE ENGINEERUPDATED 2026-11-21
PREDICT

Your pull request has sat for three days without a review. It is 600 lines, the tests pass, and the description says 'Payroll validation'. What is most likely to get it reviewed this week?

You will open hundreds of pull requests in your career, and most of what decides whether they merge quickly is settled before you press the button. A pull request is a request for someone else’s attention. Attention is the scarce thing. This chapter is about spending it well: what to put in the description, how to size and cut the change, and what to do when the people who approve your work are not the people who read your diff. The review itself, from the reviewer’s chair, is the next chapter, Code review, giving and receiving. How a team sets its standards for review is in standards and code review at scale.

The model: two costs and two readers

A reviewer pays two costs. The first is reading: understanding what changed. The second is deciding: judging whether it should. Reading cost tends to grow faster than size (a rule of thumb, not a measurement), because a reader has to hold the whole change in mind to judge any part of it. Deciding cost grows with how little the reviewer knows about why the change exists. A long diff with no context is expensive on both.

You control both. Size and shape set the reading cost. The description sets the deciding cost. A reviewer who knows the purpose, the risk and where to look can often approve a small change in minutes.

A pull request also has two readers. The first is the reviewer, a colleague who reads the diff. The second is whoever sees only the description: the person who looks at the release notes, the on-call engineer who finds your change in the history at 03:00, a release manager, or, in a regulated company, a change advisory board. The reviewer approves the code. The second reader decides whether the code goes out. Write for both, and in that order of detail: the diff for the first, the top of the description for the second.

What a reviewer can act on

The description is the cheapest thing you will ever do for a reviewer. Google’s engineering practices guide, in the reading, says the first line should be “a short summary of specifically what is being done by the CL, followed by a blank line”. (A CL is Google’s word for a change; read it as pull request.) The rest of the description carries what the diff cannot: why, how, and how you know.

A description a reviewer can act on has six parts.

Part What it says Weak Better
Title What the change does, in one line “Payroll validation” “Show every invalid row of a payroll file at once”
Why The problem, with a number or a ticket “Improve upload” “Clients fix one row, re-upload, and find the next; the last file took nine tries”
What changed The approach, in a few sentences A list of file names “A new validator runs on every row; the screen lists all errors”
What did not change The boundary, so the reviewer can stop looking Nothing “The file format and the bank’s disbursement system are untouched”
How it was checked Tests run, and anything you tried by hand “Tested” “41 new unit tests; a 5,000-row file in staging; the off path unchanged”
Risk and rollback Where it could hurt and how to undo it Nothing “Behind a flag, off by default; turning it off restores the old behaviour”

Two more lines earn their place. Where to start: “the logic is in validator; the other files are plumbing”. A reviewer who knows which file matters reads it with full attention instead of spreading it across twelve. What you want from the reviewer: “I am not sure about the duplicate-account rule; please look hard at that one”. Asking for attention where you doubt yourself is honest, and it is where reviews find things.

Write the description before you open the pull request, not after. If you cannot say what the change is for in a sentence, the change is not ready. If the why needs three paragraphs, the change is probably two changes. And review your own diff first, in the review screen, as if a stranger had written it. You will find the debug line, the stray file and the commented-out block that you would otherwise leave for someone else to find.

Size: one change, one thing

Engineering philosophies gave the principle: a good size is one change that does one thing and is safe to deploy by itself. It is a measure of focus, not a line count. Google’s author guide says the same, and adds that when in doubt you should write changes smaller than you think you need to. The staff chapter linked above reports the numbers that guide gives for what is usually reasonable and what is usually too large; treat them as a rule of thumb from one large company, not a limit.

Four habits keep changes small.

Separate the refactor from the behaviour. A rename, a move or a formatter run changes many lines and no behaviour. A reviewer can confirm that quickly if nothing else is in the diff, and cannot if a behaviour change hides inside it. Put the mechanical change in its own pull request, and say so in the title: “Move upload components into their own folder (no behaviour change)”. Merge it first. It will often be approved in minutes.

Put tests with the code they test. Tests are part of the change, and a reviewer reads them to learn what the code is meant to do. Do not split them into a later pull request, where they tend not to arrive.

Do not mix an unrelated fix into a change. You will see a bug in the next function. Write it down and fix it separately. If the fix is one line, a separate pull request costs the reviewer thirty seconds, and makes the history readable.

Leave the system working at each step. Each change, merged alone, must not break anything. That sounds obvious until you cut a feature into four pieces and find that the second only works with the third. The next two sections are about cutting so that each piece stands.

Cutting a large change

You will sometimes start on a change and find it is big. The way out is to choose a cut before you are deep into it, and the right cut depends on what each piece does when it is merged alone.

Cut What it looks like Works when Fails when
One change A single pull request, however long The bulk is mechanical or generated, and the reviewer has agreed to read it A reviewer must understand the logic across it all, or one bad part blocks the rest
Stacked Four changes, each branched from the one before Reviewers are quick and everything lands in the same release The first is changed in review and the rest need rebasing, or only part of the stack can be released
By layer A backend change, then a screen change The layers have different owners or an interface that needs its own review The backend change does nothing alone, so no one can see it work
Flagged series Small changes, each safe alone, behind a switch kept off The feature is user-visible and the old behaviour must stay until you are ready The flag is never removed, or the off path is not tested

A stacked series is the most common cut, and its failure is worth understanding. The pull requests are not independent. If a reviewer asks for a change to the first, you must rework the three above it. And if the release process approves changes as a unit, a stack that is half-merged is not releasable. Stacks are useful when your team has tooling for them and reviews quickly.

A flagged series is the cut that survives the most circumstances. A feature flag, which Pete Hodgson’s article on feature toggles in the reading describes in detail, is a switch that lets code sit in production without being used. You merge the validator with the flag off. Nothing changes for any user, so the change is safe to deploy and cheap to review. You merge the plumbing, the screen and the copy the same way. When all the pieces are in, one small change turns the flag on. The off path is the state that ships first, so it must stay as it was and be tested as carefully as the on path. The testing consequences are in the release management chapter’s section on flags.

For changes to code that others call, the companion technique is parallel change, also called expand and contract: add the new way beside the old, move callers across in small steps, then remove the old. The Parallel Change entry on martinfowler.com, in the reading, names it. It is how you change a shared interface without one very large pull request.

When the unit of approval is the release

In many companies a pull request is the end of the process. In a bank it is the start of one. Digital channels at Northmere Bank, which has 4,800 staff and about 38,000 corporate clients, deploys through change control. A change advisory board, a CAB, meets weekly and approves releases, meaning the set of changes that will be deployed together. It does not approve pull requests, and it does not read diffs. It reads a line or two per change, with a risk rating and a rollback plan, and decides whether the release goes out. Release management and sign-off describes the evidence a release owner assembles for that decision.

This changes what your pull request must do.

Each change must be explainable in one sentence to someone who has not seen the code. The first line of your description will be copied into the release record. “Show every invalid row of a payroll file at once” can be approved. “Payroll validation” makes the board ask questions, and a question at a CAB can cost a week.

Each change must be safe to ship by itself. The board approves a release on Thursday; the deploy happens later. If your change is half of a feature, and the other half misses the pack, the release has half a feature in it. This is the strongest reason to prefer a series that is safe at every step.

Risk and rollback belong in the description. Not as decoration. They are the lines the release owner copies. A flag that is off by default, with a sentence on how to switch it, answers the board’s usual two questions before they are asked.

Turning the flag on is its own decision. Merging code behind an off flag changes no customer’s experience. Switching it on does. Many companies record that as a separate change, so that the risk of the code and the risk of the exposure are approved on their own terms. Ask how your company’s change control treats a configuration change. Do not assume.

None of this is a reason to dislike change control. It exists because a bank’s mistakes are paid in other people’s salaries. It is a reason to learn its unit of approval and shape your work to it.

Getting through review

Open the pull request when it is ready to be read, or as a draft if you want early views on direction and say so. Pick reviewers with intent: one who owns the code, and, for a risky change, one who knows the domain. If your team has a CODEOWNERS file, it will often choose the owner for you.

Tell the reviewer when you need it. “Release cut-off is Wednesday noon; I know that is tight” is information. An unexplained deadline is pressure; an explained one lets the reviewer say what is possible.

How to take a review well is covered in Code review, giving and receiving; the habits that matter for a merge are these.

Answer every comment. Fix it, or say why you disagree, or ask. A silent push of new commits leaves the reviewer to re-read everything to find what moved. When a comment names a labelled severity, as in the Conventional Comments scheme in the reading (labels such as issue, suggestion, nitpick and question, with optional non-blocking decoration), do the blocking ones first.

Do not take review as a verdict on you. A comment is a comment on the diff. If it stings, wait an hour before replying. If two comments disagree, ask the reviewer you trust more to say which wins.

Keep follow-up work out of the change. If review turns up something sound but out of scope, open a ticket and say so in the thread. The reviewer then knows it is not lost, and the change does not grow.

Check what the agent wrote. If an AI coding agent wrote part of the diff, you are still the author, and the reviewer is trusting your description. The chapter Working with AI coding agents covers what to verify before you open the pull request.

Where practitioners disagree

Stacked changes or flags. Teams with good stacking tools and frequent releases swear by stacks, because every piece is small and reviewed in order. Teams under change control, or with slow reviews, prefer flags, because pieces stand alone. Both are small changes. They differ in what happens when review finds a problem in the first piece, and in what the release unit looks like.

Squash or keep the history. Squashing a pull request into one commit gives a clean main branch and loses the steps. Keeping the commits preserves the story and lets a reviewer read one at a time, at the cost of a noisy history unless the commits are tidy. The pull request description is what survives either way, which is another reason to write it well.

Draft early or open when ready. Early drafts catch wrong directions cheaply. They also train reviewers to ignore your notifications. A workable rule: use a draft when you want an opinion on direction, and say what you want.

Review before CI is green, or after. Some reviewers refuse until the build passes. A red build from an unrelated flaky test is a reason to tell the reviewer, not to wait. Say which failure is not yours, and link the ticket for the flaky test.

Day to day

The pull request is a small part of a rhythm. Here is a typical week.

Before you start, ten minutes. Write the title and the why before the code. If you cannot, ask the person who gave you the work.

While you work, daily. Keep a branch that is short-lived. If it is open more than two or three days, ask whether the work should be cut. Commit often, and rebase on the main branch so that the conflict is small.

Before you open it, fifteen minutes. Read your own diff, remove what does not belong, run the tests, and write the description with the six parts. Check that the pull request is safe to merge alone.

After you open it, once or twice a day. Check for comments between tasks rather than waiting for a notification. Answer within a few hours, and reply before you push.

Reviews you owe, daily. Review other people’s changes as often as you ask for theirs. A team where everyone reviews promptly is a team where yours is reviewed promptly.

On the day the release pack closes. Check that every change you own for the release has a clear first line, a rollback line and a merged status. Tell the release owner anything you changed since you wrote it.

After the release, ten minutes. Look at the dashboard or the logs for your change, and at the flag state. If the feature is flagged, put the removal of the flag in the backlog now, with a date.

BY ORG SIZE
STARTUPunder 30 people

There may be one reviewer, or none, and nobody to approve a release. The temptation is to merge big changes straight to main. Keep the habits anyway, because the reader is you in six months. Write the title and the why; they become your changelog. Keep changes small, because with three engineers a bad deploy takes the whole company down, and a small change is quick to undo. Use a flag for anything half-finished, and ask a teammate to read the risky ones even when no rule says you must.

SCALE-UP30 to 300

Reviewers exist, but review has become a queue, and the first complaint is that it is slow. Teams add a pull request template, a CODEOWNERS file and a rough target for first response. Your description is what lets a reviewer from another team understand your change. Stacked changes are tempting, and tooling may not support them yet. Expect to be asked for smaller changes, and to be asked to review in return. Agree with your lead what counts as a risky change that needs a second reviewer.

ENTERPRISE300 and up

Approval is layered: a code reviewer, often an owner, and then a release process with a change record and a board. Your description is read by people who never open the diff, and is copied into a record that an auditor may read a year later. Link the ticket, state the risk and the rollback, and name how it is switched off. Learn when the pack closes and what the board asks, and ask your release owner to read a draft the first time.

ARTEFACT Write a pull request description a reviewer can act on ~30 MIN
YOU PRODUCEA pull request description with title, why, what changed, what did not, how it was checked, risk and rollback

Template

# <Title: what the change does, in one line>

**Why**: <the problem, with a number, a ticket or an example>

**What changed**: <the approach, in a few sentences>

**What did not change**: <the boundary: what the reviewer can ignore>

**Where to start**: <the file or function that carries the logic>

**How it was checked**
- Tests: <what, how many>
- By hand: <what you tried, where, with what data>
- Not tested: <what, and why>

**Risk and rollback**
- Risk: <where it could hurt>
- Switch off or undo: <the flag, the revert, the steps>

**Safe to ship alone?** <yes or no; what else it depends on>

**Self-review**: <what you found and changed when you read your own diff>

**What I want from you**: <where you are unsure, and any deadline>
WORKED EXAMPLE

Ebubechukwu is a mid-level engineer on Northmere Bank’s digital channels team. Ylva, a senior engineer on the team, reviews. The change is small and has a real judgement in it.

Warn when the same account appears twice in one payroll file

Why: Corporate clients sometimes upload a file with the same account number twice. Some are mistakes. Some are legitimate, such as a salary and a bonus in one file. Today neither is flagged, and the bank’s disbursement system pays both. Support handled 14 calls last quarter about double payments, from the support log (illustrative).

What changed: A new check lists each account number that appears more than once, with its row numbers. The screen shows it as a warning that the client must acknowledge. It does not block the upload.

What did not change: The file format, the other validation rules and the bank’s disbursement system. Files with no duplicates behave exactly as before.

Where to start: duplicate_check is 44 lines. The rest is its 74 lines of tests.

How it was checked

  • Tests: 9 new unit tests, covering no duplicate, one pair, three of the same account, a duplicate in the last row and an empty file. The existing suite passes.
  • By hand: a 5,000-row file with 12 duplicates in staging; the warning listed all 12. Upload time was 1.9 seconds against 1.7 seconds before.
  • Not tested: files over 5,000 rows, which the screen rejects already.

Risk and rollback

  • Risk: a warning clients ignore, or a slower upload on large files.
  • Switch off: the flag payroll_dup_warning, off by default. With it off, the screen behaves as it does today.

Safe to ship alone? Yes. Deploying with the flag off changes nothing.

Self-review: Reading the diff as a stranger, I removed a leftover debug line and renamed one test that said “dupes” to say what it checks.

What I want from you: Please look hardest at whether a warning, not an error, is the right call. Cut-off is Wednesday at noon.

The description is 118 changed lines, safe to merge alone, and answers the board’s two questions in the risk lines.

Now you

You are Ebubechukwu, on Northmere Bank’s digital channels team. The corporate payroll upload screen today stops at the first bad row in a file and shows one error, so clients fix one row and upload again. Files hold up to 5,000 rows (illustrative). You have split your large change and opened the first piece: the validator. It adds a new module that checks each row for an account number that is not 10 digits, an amount of zero or less, and an empty employee ID, and returns every error with its row number. It is 340 changed lines: 180 of code in one file, and 160 of tests across three files, with 41 test cases. Nothing calls the module yet, so no screen changes. The build is red because an unrelated test, owned by another team, fails about one run in five. Ylva will review. The change advisory board’s pack closes Wednesday at noon, and it approves releases, not pull requests. Write the description.

Self-check

DECIDE

Ebubechukwu's change to the corporate payroll upload screen is 900 changed lines: 190 moving and renaming components with no behaviour change, 340 for a new row validator (180 code and 160 tests), 90 for an API change, 170 for an error-list screen, 40 for wording, 30 for a flag and its config, and 40 for a migration. It is Monday. Ylva will review and is free about two hours a day. The change advisory board meets Thursday, approves releases and not pull requests, and its pack closes Wednesday at noon. The flag would stay off at first.

READING
  1. DOC
    Small CLs Google Engineering Practices

    Why small changes are reviewed faster and break less, and that smallness is about focus and not only line count. Apply it to every change before you open it.

  2. DOC
    Writing good CL descriptions Google Engineering Practices

    The first-line rule and what the body should carry. It is the plainest statement of why a description is a record for later readers as well as for the reviewer.

  3. DOC
    Conventional Comments

    A labelling scheme for review comments, with labels such as issue, suggestion, nitpick and question and a blocking or non-blocking mark. Use it to tell which review comments you must answer first.

  4. POST
    Feature Toggles (aka Feature Flags) Pete Hodgson, on martinfowler.com

    The long-form guide to kinds of toggle and how to implement and manage them. Read it before you merge a half-finished feature behind a flag, so that the flag has an owner and a removal date.

  5. POST
    Parallel Change Danilo Sato, on martinfowler.com, 2014

    A short entry on expand and contract, the way to change a shared interface in small safe steps instead of one very large pull request.

  6. DOC
    Working in small batches DORA

    The research programme's page on why small batches speed feedback, and the pitfall of regrouping them before release, which brings back the big batch you cut.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: Code review, giving and receiving →