Pull Request Size

PR Size

Emily Fueger avatar
Written by Emily Fueger
Updated over a week ago

Definition

The number of lines of code that were added, changed or removed in a pull request.

Note: You may see a difference in calculation between PR Size in GitHub vs. Velocity, and this is because GitHub shows raw lines added and Velocity shows relevant lines added.

Why it matters

Typically, pull requests that are small are easier to review and get through the software development process faster. Each pull request also poses less risk because less is being changed at any one given time.  Larger pull requests are more likely to get stuck in the review process and take up a lot of time from several engineers.

How to use it

When this metric is consistently high for an individual or team, it usually represents a coaching opportunity. During a coaching session, you may encourage a mentor to take a large pull request and work through how the solution may have been implemented in more incremental changes.

It’s far easier to keep pull requests small than it is to break them down when they’re already large, so be on the lookout for any individual Pull Request that exceeds the team’s typical size, and consider helping team members merge them before they get too big. 

We suggest that you use Velocity to set Decrease pull request size targets

to track the percentage of PRs that are larger than a line count threshold. You might target having more than 90% of PRs with less than 400 lines, for example.

Benchmarks

The median organization averages a PR size of 197 lines of code. A quarter of organizations have PRs averaging less than 161 lines, while, at the other extreme, a quarter have PRs averaging more than 237 lines.

Did this answer your question?