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 your GitHub Enterprise instance. 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.
Required reviews
Repository administrators can require that all pull requests receive at least one approved review from someone with write or admin permissions before they're merged into a protected branch. For more information, see "About protected branches."
When required reviews are enabled, anyone with access to the repository can approve changes in a pull request. However, to merge your pull request you need someone who has write or admin permissions in the repository to approve your pull request's changes in their review.
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."
Merging a pull request on GitHub Enterprise
Under your repository name, click Pull requests.
In the "Pull Requests" list, click the pull request you'd like to merge.
-
Depending on the merge options enabled for your repository, you can:
- Merge all of the commits into the 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.
- Squash the commits into one commit by clicking the merge drop down menu, selecting Squash and merge and then clicking the Squash and merge button.
-
Rebase the commits individually onto the base branch by clicking the merge drop down menu, selecting Rebase and merge and then clicking the Rebase and merge button.
Note: Rebase and merge will always update the committer information and create new commit SHAs. For more information, see "About pull request merges."
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.
If you clicked Rebase and merge in step 3, click Confirm rebase and merge.
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 close corresponding issues using a keyword in your pull request or commit message. For more information, see "Closing issues using keywords."
Further reading
- "Reverting a pull request"
- "Syncing your branch" using GitHub Desktop
- "About pull request merges"
- "Addressing merge conflicts"