Data report"State of code review 2024" is now liveRead the full report
Beginner's guide to stacked diffs

Stacked diffs, also known as stacked changes or pull requests (PRs), are a series of code changes made on top of each other in a specific order. It's like stacking blocks where each block is a small, independent change that contributes to building a larger feature.

  1. Small & Manageable Changes: Breaks down large features into smaller, more manageable pieces, making it easier to review and test.

  2. Continuous Progress: Allows you to keep working on subsequent changes without waiting for the earlier ones to be merged.

  3. Easier Reviews: Smaller diffs make it easier for reviewers to understand and give feedback.

  4. Isolated Testing: Each change can be tested independently, reducing the risk of bugs.

  1. Start Small: Make a small change in your code and submit it as a PR.

  2. Stack On: Create a new branch from the first PR, make another change, and submit a new PR.

  3. Rinse & Repeat: Continue stacking new changes on top of the previous ones.

Graphite is a tool that simplifies working with stacked diffs. It keeps track of the order and dependencies of your changes, making it easy to manage and submit stacks of PRs.

  • Keep each diff focused on a single change.

  • Ensure each diff builds off the changes made in the previous one.

  • Regularly sync with the main branch to avoid merge conflicts.

  • Review and merge from the bottom up - the oldest diffs first.

Remember, the key to successful stacked diffs is to keep each change small, focused, and reviewable.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2