Reviewing and merging pull requests in GitHub

Sara Verdi
Sara Verdi
Graphite software engineer

The process of reviewing and merging pull requests (PRs) ensures that the changes submitted by developers are thoroughly examined before being integrated into the main codebase. This guide provides a detailed walk-through on how to review pull requests in GitHub and merge them effectively.

To begin reviewing a PR in GitHub:

  1. Navigate to the repository where the pull request is made.
  2. Click on the "Pull requests" tab near the top of the repository's page to see a list of open PRs.
  3. Select the pull request you want to review by clicking on its title.

Screenshot of PR tab

Once you've opened the pull request:

  1. Start by reading the PR title, description, and the context provided by the submitter.
  2. Review the list of changed files by clicking on the "Files changed" tab. This view allows you to see the diffs and comment directly on lines of code.
  3. Use GitHub’s review functionality by clicking on the green "Review changes" button. You can then:
    • Comment: Leave feedback without approval.
    • Approve: If the PR meets all criteria.
    • Request changes: If adjustments are needed before merging.

Screenshot of approving a PR

Graphite's PR inbox acts as a centralized hub for your pull requests, which keeps your review tasks neatly organized:

  1. Log in to your Graphite account and access the PR inbox to see pull requests categorized into sections such as "Needs your review" or "Approved".
  2. Use the search functionality within the PR inbox to quickly find specific PRs based on title, description, or author.
  3. Customize your inbox sections or share them with teammates for a collaborative review process. Shared inbox sections make sure that everyone on the team has visibility into the status of pull requests and prevent PRs from being overlooked or duplicated in work efforts.

To approve a PR in GitHub:

  1. Navigate back to the "Files changed" view and click "Review changes".
  2. Select "Approve" and then "Submit review" to finalize your approval.
  3. Your approval status will be visible on the PR page, indicating to others that the PR is ready for merging.

After a PR is approved, follow these steps to merge it into the main branch:

  1. Ensure all merge conditions, like passing continuous integration checks and having the necessary approvals, are met.
  2. Click the "Merge pull request" button. If multiple merge options are available (merge commit, squash merge, rebase and merge), select the one that best suits your project workflow.
  3. Confirm the merge to integrate the changes into the main branch. You can delete the feature branch post-merge if it's no longer needed.

By following these steps and utilizing Graphite's PR inbox, teams can ensure high standards of code quality for more effective software development. Or for more pull request management and code review best practices, check out this blog post.

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