Tuesday, 3 p.m. A review request lands in your queue. The title says "fixes". The diff is 2,347 lines across 41 files, the description is empty, and the only comment is a cheerful "PTAL". You open it anyway. Twenty minutes later you've read the same method three times, you still can't say what problem it solves, and you leave one nervous comment: "Looks good overall, maybe rename this variable?" Congrats, you just approved code you didn't understand.
Whoever wrote it probably wasn't being lazy. They were deep in the work, happy it finally ran, and forgot that writing the code is half the job. The other half is getting another person to understand it well enough to say yes with a straight face. That half belongs to the author.
This post covers the author's side of review: how big a PR should be, what goes in the title and description, how to shape commits, what to check before you ping anyone, and how to handle the comments that come back. The reviewer's side lives in How to Review Code Kindly.
Your reviewer only knows what you tell them
When you open a PR, you're carrying a lot of context: the bug report, the Slack thread, the two approaches you tried and threw away at 11 p.m. Your reviewer has none of it. They have a diff, a title and whatever you typed into the description box, plus a dozen other things asking for their time.
GitHub's guide on helping people review your changes says a clear title and description "help reviewers understand the problem, the approach, and the result" (GitHub Docs). Every piece of context you leave out comes back as a question in a comment thread, and every question costs a round trip. On a team spread across time zones, one round trip can eat a whole day.
So brief your reviewer the way you'd brief a teammate joining your task halfway. They're there to help you ship something solid. The faster they get your context, the more of their attention goes to the parts that really need a second pair of eyes.
If a reviewer has to read the code to find out why the change exists, the description isn't done yet. The diff shows what changed. The description says why it had to.
Keep it small, and keep it about one thing
If you only change one habit, make it this one. Google's engineering practices guide calls 100 lines "usually a reasonable size" for a change and 1,000 lines "usually too large", with the final call left to the reviewer. It adds that a 200-line change might be fine in one file but would usually be too large spread across 50 files (Small CLs).
The same guide lists what you get in return: faster reviews, more thorough reviews, fewer bugs, less wasted work if the overall direction gets rejected, fewer merge conflicts and easier rollbacks. In Google's study of nine million reviewed changes, the median change was 24 lines (Sadowski et al., 2018). Small is simply the default there.
Line count is only a proxy, though. What you're after is one logical change: one idea someone can understand, test and revert on its own. "Add avatar upload" is one change. "Add avatar upload, refactor the profile controller and bump three dependencies" is three changes sharing a trench coat.
Reviewers hit the same limit from their side. SmartBear, a code review tool vendor, cites a study at Cisco recommending that developers review no more than 200 to 400 lines at a time, and reports from its own data that defect density drops sharply when people review faster than about 500 lines an hour (SmartBear). Hand someone 2,000 lines and they either block out an afternoon or skim. Most people skim.
How to split big work
A big feature doesn't have to arrive as a big PR. A few ways to cut it:
- Refactor first, change behavior second. One PR renames, moves and extracts with no new logic. The next one adds the feature. Google's guide recommends this split, and it lets the reviewer confirm the refactor changes nothing before thinking about what does change.
- Lay the groundwork first. The migration, the new column and the types go out in one PR with no UI. The screen that uses them comes next. Each PR can deploy on its own.
- Put unfinished work behind a flag. Merge it with the flag off by default. The PR stays small and safe, and "done" becomes a separate decision: flipping the flag, which is just as easy to flip back.
- Stack your PRs. Send PR A for review, then start PR B on top of A so you're never stuck waiting. If your team has no tooling for stacks, keep it simple: merge A, then open B against main.
- Split by reviewer. If one part needs the backend owner and another needs the mobile lead, two PRs let each of them read only the part they know.
Describe the PR in one sentence. If you need the word "and", look for the seam and split there.
A title and description worth reading
The title is what people see in notifications, in the PR list and, if your team squashes on merge, in git log for good. Say what the change does, in the imperative, specific enough that someone scanning a list knows whether it's theirs to care about. Google's guide uses "Fix bug" as its example of a description that says nothing: which bug, and fixed how? (Writing good CL descriptions)
| Title | What's wrong | Try instead |
|---|---|---|
| "fixes" | Zero context. The reviewer reads every line to guess what's going on. | "Fix oversell when two checkouts buy the last item at once" |
| "WIP: various changes" | Says "not ready" without saying what's inside. | Open it as a draft PR (it can't be merged and doesn't auto-request code owners), then give it a real title when it's ready. |
| "Update UserService" | Says where, never what or why. Every PR updates something. | "Add email-change verification to UserService" |
| "JIRA-1234" | Sends the reviewer to another tab just to learn the goal. | "Limit API to 100 requests/min per IP (JIRA-1234)": the ticket adds context and the title still stands on its own. |
| "Refactor + new feature + bump deps" | Three PRs in one. Each deserves its own review. | Three small, focused PRs. |
The description is where the real conversation starts. A good one answers the three questions every reviewer has in the first ten seconds:
- What changed, and where should I look first?
- Why was it needed: which bug, which user problem, which number?
- How do I know it works: the test command, the steps, screenshots, the edge cases you checked?
Google's guide adds two things people often skip. Mention the shortcomings of your approach if there are any. And give enough background that the description still makes sense if the linked ticket or design doc disappears one day. Before you merge, read the description once more: a PR can change a lot during review, and the description should still match what it does.
Here's the same change, before and after:
--- BEFORE ---
Title: fixes
Description: (empty)
--- AFTER (same change, written for a reviewer) ---
Title: Fix oversell when two checkouts buy the last item at once
## What
Two checkout requests from the same user could both pass the stock
check before either one decremented it, so we sold items we didn't
have. This PR takes a row-level lock on the product row around the
decrement.
## Why
Support logged 12 oversell tickets in the last 30 days (Sentry #4421).
Root cause: two requests racing between the SELECT and the UPDATE on
the inventory table.
## How to test
1. Run the new regression test: npm test -- cart.concurrency
2. On staging, open two tabs on a product with stock = 1 and click
"Buy" in both at the same time. Exactly one should succeed.
## Risk / known limits
- The lock covers one product row, so checkouts of different products
don't wait on each other.
- No migration: uses SELECT ... FOR UPDATE on the existing table.
- Doesn't cover the bulk-import path yet (follow-up: #4430).
Commits that still make sense in a year
A year from now someone (quite possibly you) will run git blame on a strange line and follow the hash back to your commit. Whatever they find there should explain the decision.
Chris Beams' How to Write a Git Commit Message is still the post most teams point to. Its seven rules boil down to this: a subject line of 50 characters or less, in the imperative, then a blank line, then a body that explains what changed and why. The how is already in the diff. His test for the subject: it should complete the sentence "If applied, this commit will ...". "Fix bug with Y" passes. "Fixed bug with Y" doesn't.
Many teams add a type prefix on top, following Conventional Commits: fix:, feat:, refactor:, with an optional scope. Changelogs get easier to generate, and you have to decide what kind of change you're actually making.
# Shape:
type(scope): short imperative subject
Body: why this change was needed, what problem it solves,
and any decision a future reader would otherwise wonder about.
# Examples:
fix(cart): lock product row to prevent oversell on checkout
feat(auth): add email-change verification
refactor(profile): move avatar upload into its own service
Then think about the shape of the history. Each commit should be one coherent step: a refactor, a test, a new behavior. A reviewer who steps through commits one at a time should see something like "extract method, add failing test, implement" instead of twenty commits called "wip". A messy history while you work is fine. Before you ask for review, tidy it with an interactive rebase (git rebase -i). And if your team squashes on merge, the PR title and description become the commit, which is one more reason to write them well.
Be your own first reviewer
Before you ping anyone, open the diff in the web UI and read it as if someone else wrote it. That small change of view catches a surprising amount: a leftover console.log, a function that doubled in size while you weren't looking, an import you no longer use, a comment that used to be true. GitHub's guide says the same thing: review your own PR first, check the diff for accidental changes and confirm the build and tests have run.
A short checklist:
- Read the whole diff, top to bottom. No skimming.
- Hunt for debug leftovers:
console.log, commented-out blocks, "TODO remove", hardcoded test values. - Check the tests. Does new logic have a test? Does the bug fix come with a regression test that fails without the fix?
- Look for changes you didn't mean to make: whitespace churn, a reformatted file, a drive-by rename. Revert them or move them to another PR.
- Comment on your own PR wherever something isn't obvious: "This looks odd, but the API returns pages of 50, so...". SmartBear calls this annotating the code before review, and notes that authors often find their own bugs while doing it.
Would you be fine with a senior engineer opening this PR cold, right now, with no explanation from you? If not, fix that first, then request review.
Self-review has a selfish upside too. Everyone has spotted a typo ten seconds after clicking "Request review". Better to catch it while it's still only yours.
When the comments come back
Pushing the code gets you halfway. The PR is finished when it merges, and in between, how you handle feedback matters as much as the code.
- Reply to every comment. "Done", "Good catch, fixed in a1b2c3", or a short reason when you didn't change it. Silence reads as "didn't see it", or worse, "don't care".
- Say what you changed. "Moved the logic into a helper and added a test for the empty case" saves the reviewer from diffing your commits to find out.
- Let commenters resolve their own threads unless your team has agreed otherwise. Resolving someone's comment without a word feels like closing the door on them.
- Push back with a reason. "I looked at that approach, but the API returns pages of 50 and caching the whole list would eat memory. Happy to hop on a call if you still feel strongly." For the reviewer's half of that exchange, see How to Review Code Kindly.
- Re-request review on purpose, with a short summary: "All comments addressed. Main changes: extracted the util, added two tests, kept the original approach for X because Y."
If a thread reaches its third round, stop typing and call. Ten minutes of talking usually settles what another day of comments wouldn't.
How PR habits change as the team grows
How much ceremony a PR needs depends on who's reading it. A rough guide:
| Team | What matters most | Habits that fit |
|---|---|---|
| Solo / freelance | Your reviewer is you, six months from now. The PR is where you record why you decided what you decided. | Even with nobody reviewing: a clear title, a few lines of "why", and commit messages that make git log readable later. |
| Small team (2 to 8) | Speed. Everyone knows the codebase, reviews feel like conversations, trust is high. | Small PRs that move fast. A sentence or two of context is enough. Same-day async review is a fair expectation. |
| Mid-size (10 to 50) | Reviewers may not have the full picture. New people join all the time. Changes cross team lines. | Full what/why/how descriptions, screenshots for UI work, a test plan. Pull in a reviewer from any other team you touch. |
| Large (50+) | Reviewers can be strangers. Audit trails, compliance and response SLAs come into play. | PR templates enforced by tooling, required approvals, security review for sensitive changes, links to design docs and tickets, a rollback plan for risky changes. |
A four-person startup doesn't need a rollback plan in every PR. A payments team usually does. Match the ceremony to the stakes, and look at your norms again whenever the team roughly doubles.
Try this week
- Before you open your next PR, write its one-sentence summary. If it has an "and", split it.
- Fill in What, Why and How to test, even for a small change.
- Read your own diff in the web UI and leave one comment on the trickiest part.
- Rewrite one commit subject so it completes "If applied, this commit will...".
- When feedback arrives, reply to every comment before you re-request review.
For a closer look at what makes a reviewer comfortable hitting approve, read Pull Requests Reviewers Can Approve Without Guessing. And when the comments start to sting, How to Give Feedback, and How to Take It picks up from there.