Read Anthropic’s case study about Graphite Reviewer

Pull request best practices for 2024

Sara Verdi
Sara Verdi
Graphite software engineer
Try Graphite

Pull requests serve as a platform for discussing, reviewing, and merging code changes. This guide takes a look into pull request best practices and how you can use Graphite's PR inbox to streamline this essential process.

A pull request (PR) allows developers to inform team members that they have completed a feature or fix that is ready to be merged into the main codebase. Below are some examples of best practices for creating comprehensive PRs and reviewing them:

  • Use clear titles: The title of your PR should be concise and informative. For example, instead of "Fix bug," use "Fix out-of-bounds error in data sorting algorithm."
  • Detailed descriptions: The PR description should provide context for the change, including what was changed, why, and its impact. Include references to related tickets or other documentation.
  • Small, manageable sizes: Keep PRs small and focused. Large PRs are hard to review effectively. If a feature requires a lot of changes, consider breaking it into smaller, incremental PRs.
  • Timely reviews: Aim to review PRs promptly, as this helps to avoid bottlenecks in the development process.
  • Constructive feedback: Focus on providing constructive, specific feedback. Instead of vague comments like "This looks odd," provide clear, actionable suggestions.
  • Use a checklist: To ensure thorough reviews, use a checklist that includes code style, security implications, and performance considerations.
  • Be polite and respectful: Remember that behind every code submission is a person. Maintain professionalism and courtesy in your comments.
  • Be specific with feedback: Point out issues directly related to the line or block of code. This avoids misunderstandings and improves the clarity of your reviews.
  • Acknowledge good work: When you find code that is well-done or clever, point it out. Positive reinforcement can be incredibly motivating.
  • Ensure approvals: Do not merge PRs without the required reviews. If your project requires two approvals, wait until you get them before merging.
  • Use automated checks: Leverage tools like Graphite to automate certain checks, such as style guides or automated tests, to ensure that only PRs that meet certain criteria are merged.
  • Delete branches post-merge: To keep your repository clean, delete feature branches after their PRs are merged.

Graphite's PR inbox helps you stay organized and see which PRs need your attention — all in one place. You can customize this inbox with sections like 'Needs your review' or 'Waiting for review', making it easier to manage your workflows. Additionally, you can create custom filters and share these configurations with your team.

Adopting these pull request best practices can transform the way your team collaborates and enhance the overall quality of your codebase. By integrating tools like Graphite's PR inbox, you can better organize your PR management to ensure that code reviews are both efficient and effective. Remember, the most successful teams are those that continually refine their processes and tools to better suit their evolving project demands and team dynamics.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Built for the world's fastest engineering teams, now available for everyone