Merge a pull request (Merge Button)

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" for details.

PUT /repos/:owner/:repo/pulls/:pull_number/merge

Input

Name Type Description
commit_title string Title for the automatic commit message.
commit_message string Extra detail to append to automatic commit message.
sha string SHA that pull request head must match to allow merge.
merge_method string Merge method to use. Possible values are merge, squash or rebase. Default is merge.

Response if merge was successful

Status: 200 OK
{
  "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "merged": true,
  "message": "Pull Request successfully merged"
}

Response if merge cannot be performed

Status: 405 Method not allowed
{
  "message": "Pull Request is not mergeable",
  "documentation_url": "https://developer.github.com/enterprise/2.18/v3/pulls/#merge-a-pull-request-merge-button"
}

Response if sha was provided and pull request head did not match

Status: 409 Conflict
{
  "message": "Head branch was modified. Review and try the merge again.",
  "documentation_url": "https://developer.github.com/enterprise/2.18/v3/pulls/#merge-a-pull-request-merge-button"
}