Article version: Enterprise Server 2.20

Merging a pull request

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

In this article

About pull request merges

By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch. However, there may be restrictions on when you can merge a pull request into a specific branch. For example, you may only be able to merge a pull request into master if required status checks are passing. For more information, see "About protected branches."

If the pull request has 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.

You can't merge a draft pull request. For more information about draft pull requests, see "About pull requests."

You can have head branches automatically deleted after pull requests are merged in your repository. For more information, see "Managing the automatic deletion of branches."

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.

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:

    Note: Rebase and merge will always update the committer information and create new commit SHAs. For more information, see "About pull request merges."

  4. If prompted, type a commit message, or accept the default message.

    Commit message field

  5. Click Confirm merge, Confirm squash and merge, or 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.

You can link a pull request to an issue to automatically close the issue when someone merges the pull request. For more information, see "Linking a pull request to an issue."

Further reading

Ask a human

Can't find what you're looking for?

Contact us