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

If you decide you don't want the changes in your branch to be merged to the upstream branch, you can also close the pull request without merging. Alternatively, you can ask the pull request creator to allow anyone with push access to the upstream repository to make changes to their pull request. Pull request creators can enable this option for existing and new pull requests. For more information, see "Allowing changes to a pull request branch created from a fork."

If you'd like to merge changes into a protected branch that has required pull request reviews for pull requests enabled, you'll need to make sure your pull request has met the pull request review policy. In this policy, pull requests must have one approved review and cannot have any reviews that request changes before they can be merged.

Note: 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."

Merging a pull request using the GitHub web interface

If the merge will not have any conflicts, you can merge the pull request online.

Tip: The pull request page on GitHub includes custom instructions for manually merging a pull request on the command line. You can use these instructions if your pull request can't be merged online, or if you'd like to test your changes locally before merging. These instructions can be found near the Merge pull request button.

  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:

    • Merge all your commits into your base branch by clicking Merge pull request. If the Merge pull request option is not shown, then click the merge drop down menu and select Create a merge commit. merge-pull-request-button
    • Squash your commits into one commit by clicking the merge drop down menu, selecting Squash and merge and then clicking the Squash and merge button. select-squash-and-merge-from-drop-down-menu click-squash-and-merge-button

    Tip: If you don't see the Squash and merge or Rebase and merge options, ensure that you've clicked the merge button drop down menu to see other merge options. merge-drop-down-menu-arrow

  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.

Checking out a pull request locally

When someone sends you a pull request from a fork or branch of your repository, you may want to merge it locally to resolve a merge conflict or to test and verify the changes on your local computer before merging on GitHub. For more information, see "Checking out pull requests locally."

Further reading