Merge a pull request into the upstream branch when work is completed. Anyone with push access to the repository can complete the merge.

If the pull request does not have any merge conflicts, you can merge it on GitHub. If the pull request does have merge conflicts, or if you'd like to test the changes before merging, you can check out the pull request locally and merge it using the command line.

If you decide you don't want the changes in a topic branch to be merged to the upstream branch, you can close the pull request without merging.

To merge a pull request into a protected branch with required pull request reviews enabled, the pull request must meet the review policy. In this policy, a pull request:

  • Must have one or more approved reviews
  • Can't have any reviews that request changes

Repository owners and administrators can merge pull requests on branches that have required pull request reviews enabled, regardless of whether the pull request has been approved. You can enforce all users, including repository owners and administrators, to obtain an approval before merging a pull request to a protected branch. For more information, see "Enabling required reviews for pull requests."

If a person who requested changes isn't available to give an approved review, or if a pull request has changed significantly since it was reviewed, repository administrators or people with write access can dismiss a review. For more information, see "Dismissing a pull request review."

After all required reviewers have approved a pull request, you won't be able to merge it if there are other open pull requests with pending or rejected reviews and those pull requests have a head branch pointing to the same commit. Someone with write or admin permissions will need to approve or dismiss the blocking review on the other pull requests before you can merge.

Merging a pull request on GitHub

  1. Under your repository name, click Pull requests. Issues and pull requests tab selection

  2. In the "Pull Requests" list, click the pull request you'd like to merge.

  3. Depending on the merge options enabled for your repository, you can:

  4. If you clicked Merge pull request or Squash and merge in step 3, type a commit message, or accept the default message. Under the commit message box, click Confirm merge or Confirm squash and merge. Commit message field

  5. If you clicked Rebase and merge in step 3, click Confirm rebase and merge.

  6. Optionally, delete the branch. This keeps the list of branches in your repository tidy.

Pull requests are merged using the --no-ff option, except for pull requests with squashed or rebased commits, which are merged using the fast-forward option.

Further reading