What Is PR Size?
PR size is the number of lines a pull request changes: lines added plus lines deleted. Keep most pull requests under 200 changed lines and treat 400 as the limit. Past 400 lines, reviewers find fewer defects and approve with less scrutiny. Above 1,000 lines, split the PR.
2-minute setup • No credit card required
What it means
PR size is usually measured as lines changed (additions + deletions), the number GitHub, GitLab and Bitbucket show at the top of every diff. Some teams also track files changed, because 200 lines in one file is easier to review than 200 lines across 30 files. The research behind the common 400-line limit comes from a SmartBear study of about 2,500 code reviews at Cisco: reviewers found the most defects when they reviewed 200 to 400 lines at a time, at under 500 lines an hour, for no more than 60 to 90 minutes. Past that, defect discovery dropped sharply. Google's engineering practices say about 100 lines is usually a reasonable size and 1,000 lines is usually too large. Google's own data shows how small changes can get: in the 2018 case study "Modern Code Review at Google", the median change touched about 24 lines. The exact number matters less than the rule behind it: one pull request should contain one logical change that a reviewer can understand in a single sitting.
Why PR Size matters
Size is the variable that moves almost every other review metric. Large pull requests wait longer for a first review, because reviewers put off what looks like an hour of work. They get shallower reviews: a 1,000-line diff often gets a quick "looks good to me" while a 20-line change gets real comments. They're riskier to merge, harder to revert, and more likely to conflict with other work while they sit open. Small pull requests do the opposite: faster pickup, better comments, safer deploys and shorter cycle time. If your team's cycle time is slow, PR size is usually the first thing to check. For GitHub repositories, Gitmore's reports include the lines added and removed for each pull request, so oversized PRs show up in Slack or email without anyone building a dashboard.
How to measure PR size
- Count lines changed per pull request: additions plus deletions. GitHub shows them on the Files changed tab and returns additions and deletions from the pull request API. GitLab shows them at the top of the merge request's Changes tab. Bitbucket Cloud returns lines_added and lines_removed per file from the pull request diffstat endpoint.
- Leave out lines nobody reviews: lock files, generated code, snapshots and vendored dependencies.
- Report the median and the 90th percentile each week, not the average. One 5,000-line dependency bump ruins an average.
- Set a team goal on the share of PRs under 400 lines, for example 80% or more.
- Read size next to time to first review and cycle time, so you can see whether smaller PRs actually move faster.
PR size benchmarks
A practical scale most teams can adopt. The review times use the roughly 500 lines an hour reviewing rate from the Cisco study.
| Size | Lines changed | Review time | What happens in review |
|---|---|---|---|
| XS | Under 50 | A few minutes | Every line gets read. Usually approved the same day. |
| S | 50 to 199 | Up to ~25 min | Thorough, line-by-line review. The target for most PRs. |
| M | 200 to 399 | ~25 to 50 min | Still within the range where reviewers catch the most defects. The upper limit for one sitting. |
| L | 400 to 999 | 50 min to 2 h | Attention drops and reviewers start skimming. Split it if you can. |
| XL | 1,000+ | 2 h+, several sittings | Rubber-stamp territory. Split it, or review it in a live walkthrough. |
Sources: SmartBear, Best Kept Secrets of Peer Code Review (Cisco study, about 2,500 reviews); Google Engineering Practices, "Small CLs"; Sadowski et al., Modern Code Review: A Case Study at Google (ICSE 2018).
What counts, and what doesn't
- Count: source code, tests and configuration a reviewer has to read. Tests count, but a PR that's half tests is easier to review than the line count suggests.
- Don't count: lock files (package-lock.json, yarn.lock, poetry.lock), generated code, snapshot files and vendored dependencies. On GitHub, mark them with linguist-generated=true in .gitattributes so they collapse in the diff.
- Treat separately: pure renames, file moves and formatting runs. They're large but mechanical. Put them in their own PR so they don't hide real changes.
- Files matter too: if a PR touches more than about 10 files, check whether it's really one change, even when the line count is fine.
How to split a large pull request
- Refactor first, change behavior second. Open a preparatory PR that only restructures code (no behavior change), then a small PR with the actual feature or fix.
- Ship thin vertical slices. Deliver one narrow path end to end (one endpoint, one screen, one case) and add the rest in follow-up PRs.
- Merge unfinished work behind a feature flag. Code can land on main in small pieces while staying off for users until it's complete.
- Stack your pull requests. Each PR targets the previous one's branch, so reviewers see one small step at a time. Tools like Graphite or GitLab's glab stack command handle the rebasing.
- Split mechanical from logical changes. Renames, moves, formatting and dependency bumps each get their own PR.
- Use expand and contract for databases. Add the new column or table in one PR, switch the code in the next, and remove the old one last.
Enforce it automatically
A rule people have to remember gets forgotten. This GitHub Action labels every pull request size/XS to size/XL and shows a warning on PRs of 400 lines or more. It only reads the PR's own counts, so it needs no checkout and runs in seconds.
.github/workflows/pr-size.ymlname: PR size
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
pull-requests: write
issues: write # labels are created through the issues API
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const lines = pr.additions + pr.deletions;
const size =
lines < 50 ? 'XS' :
lines < 200 ? 'S' :
lines < 400 ? 'M' :
lines < 1000 ? 'L' : 'XL';
const label = `size/${size}`;
// Drop the old size label when the PR grows or shrinks.
for (const { name } of pr.labels) {
if (name.startsWith('size/') && name !== label) {
await github.rest.issues.removeLabel({ ...context.repo, issue_number: pr.number, name });
}
}
await github.rest.issues.addLabels({ ...context.repo, issue_number: pr.number, labels: [label] });
if (lines >= 400) {
core.warning(`This PR changes ${lines} lines. Consider splitting it (target: under 400).`);
}
The counts include lock files and generated code. If those inflate your numbers, raise the thresholds or use a labeler that supports ignore patterns. On pull requests from forks the token is read-only, so the label step fails; open source repos should use a labeler app instead.
PR size and AI coding agents
Agents like Claude Code, Cursor, Copilot and Codex write a lot of code quickly, so their pull requests are often far larger than a person would write in the same time. The review limits don't change: a reviewer still finds the most defects in 200 to 400 lines.
- Ask the agent to plan the work as a list of steps and open one PR per step, instead of one PR for the whole feature.
- Put your size rule in the agent's instructions file (AGENTS.md, CLAUDE.md or .cursor/rules), for example: "Keep each pull request under 400 changed lines; split larger work."
- Check generated PRs for code that duplicates helpers you already have. That's a common reason agent PRs are bigger than they need to be.
- Track AI-written and human-written PRs separately so you can see whether agents are pushing your median size up.
Real-world example
A team's median PR is 640 lines and the median time to first review is 26 hours. They add the size label workflow, agree that 80% of PRs should be under 400 lines, and start opening preparatory refactor PRs and feature-flagged slices. Six weeks later the median PR is 180 lines, time to first review is down to 5 hours, and reviewers leave more comments per PR, because they're reading every line instead of skimming. Total lines shipped per week barely changed; the same work just arrives in smaller pieces.
Common questions
How large is too large for a PR?
More than 400 changed lines is too large for a thorough review in one sitting, and more than 1,000 is too large for almost any team. The Cisco code review study found defect detection drops sharply after 200 to 400 lines, and Google's engineering guide calls 1,000 lines usually too large. Lock files and generated code don't count toward the limit.
What is a good PR size?
Under 200 changed lines for most pull requests, with 400 as the upper limit. Google's guide calls about 100 lines usually reasonable, and the median change at Google is about 24 lines. More important than the number: the PR should hold one logical change the reviewer can understand without other context.
Does PR size count deleted lines?
Yes. The standard measure is additions plus deletions, which is what GitHub, GitLab and Bitbucket show on the diff. Deleted lines still need review, because removing code can break callers. Some teams report additions and deletions separately so that cleanup PRs, which are mostly deletions, don't look like big feature PRs.
How many files should a pull request change?
There's no hard rule, but if a PR touches more than about 10 files, check that it's really one change. Many files with small edits are harder to review than one file with the same number of lines, because the reviewer has to keep more context in their head.
Don't small pull requests slow the team down?
Usually the opposite. Each small PR has a little more overhead (a description, a CI run, a review request), but small PRs get picked up faster, need fewer review rounds and are safer to deploy, so total cycle time goes down. If the overhead feels heavy, automate it with a PR template, fast CI and stacked PRs.
How do I review a large PR that can't be split?
Ask the author for a short walkthrough, live or recorded. Review commit by commit if the history is clean. Start with the tests and the riskiest files, and split the review across sittings of under an hour. Large mechanical changes such as renames or generated code are fine to review with a quick scan, once the author confirms nothing else is mixed in.
What is a stacked pull request?
A chain of small pull requests where each one builds on the branch of the one before it. Reviewers review and merge them in order, one small step at a time, while the author keeps working on the next step. Tools like Graphite or GitLab's glab stack command handle the rebasing when an earlier PR in the stack changes.
How do I limit PR size on GitHub?
GitHub has no built-in size limit. Add a workflow that labels or warns on large PRs (like the one on this page), and write the limit into your pull request template and CONTRIBUTING.md. Turn the warning into a failing check only once the team agrees on exceptions such as dependency bumps.
Track PR Size Automatically
Gitmore turns your git activity into automated reports with real metrics — delivered to Slack and email.
Get Started FreeNo credit card • No sales call • Reports in 2 minutes