Skip to content

Say hello to the new PR page.

Read more

Pull request approval permissions and rules in GitHub

Kenny DuMez
Kenny DuMez
Graphite software engineer
Try Graphite


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


GitHub offers a framework for managing pull request (PR) approvals, to maintain high code quality and ensure that changes meet project standards before they are merged. This guide details the permissions and rules surrounding PR approvals in GitHub, helping teams implement effective collaboration and code governance practices.

PR approval permissions determine who can review and approve changes in a pull request. These permissions are crucial for enforcing code review policies and ensuring that only authorized individuals can approve changes.

In GitHub, the following individuals typically have permission to approve PRs:

  • Repository collaborators: Users explicitly granted collaborator status on the repository.
  • Organization members with write access: Members of an organization who have been given write access to the repository.
  • Code owners: Users specified in the CODEOWNERS file in the repository, who are automatically requested for review when changes affect code they own.

GitHub allows repository administrators to configure PR approval settings through branch protection rules. These settings can specify:

  • Number of required reviews: The minimum number of approvals needed before a PR can be merged.
  • Dismiss stale reviews: Automatically dismiss approved reviews when new commits are pushed to the PR.
  • Require review from code owners: Enforce that code owners must review changes to code they own before merging.

GitHub's branch protection rules provide several options for managing how approvals are handled within a project:

  • Pull request author cannot approve their own pull request: This rule ensures that the author of a PR cannot approve their changes, requiring at least one other team member to review and approve the PR. This practice promotes a more objective code review process.
  • Restrict who can dismiss pull request reviews: Control who has the authority to dismiss reviews, which is crucial for maintaining the integrity of the review process.
  • Include administrators: Even repository administrators are subject to the same PR approval rules, ensuring that all code undergoes review regardless of the submitter’s role.

To set up PR approval rules in GitHub:

  1. Navigate to your repository settings: Go to the 'Settings' tab of your repository.
  2. Access the branches section: Click on 'Branches' on the left sidebar.
  3. Edit or add branch protection rules: Click on 'Add rule' or edit an existing rule for the branch you want to protect.
  4. Configure the approval settings: Under 'Pull Request reviews', adjust the settings to meet your project's requirements.
  5. Save the changes: Click 'Save changes' to apply the new or updated branch protection rules.
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