Git Best Practices for Developers

Chapter 2 · Practice 2 of 4

Keep pull requests small and focused

From Branches and pull requests

Why it matters

Reviewers give careful feedback on a 150 line change and skim a 1,500 line one. Small pull requests get reviewed faster, catch more bugs and are easier to revert.

If a feature is large, split it into a series of pull requests that each make sense alone:

  1. The data model
  2. Then the API
  3. Then the UI

Keep refactors and renames in their own pull request so the real change is not buried.

If you cannot avoid a big pull request, guide the reviewer with a description of where to start.

Do

  • Aim for a pull request a reviewer can read in one sitting
  • Put pure renames and moves in a separate pull request