Perform an "Update branch" on a pull request via the REST API
We are pleased to announce a new API for updating the branch on a pull request, the Update Branch API. Rather than having to manually click a button to update the HEAD of a pull request branch with the latest changes from the base branch, you can now do so with one REST API endpoint call.
Why not just use the Merging API? Good question, and of course you can! The advantage of using this new API is that you only need the pull request number, not the base
or head
. This could potentially save a few roundtrips to the API and reduce the risk of getting rate limited.
To access the new endpoints, you must provide a custom media type in the Accept header:
application/vnd.github.lydian-preview+json
The update a pull request branch endpoint allows you to update the HEAD of the pull request branch for a pull request.
PUT /repos/:owner/:repo/pulls/:pull_number/update-branch
During the preview period, we may change aspects of these APIs based on developer feedback. If we do, we will announce the changes here on the developer blog, but we will not provide any advance notice.
Feedback welcomed!