Update a pull request's branch with its target
POST/api/repos/{owner}/{repo}/pulls/{number}/update-branch
updatePullRequestBranch
Brings the pull request's source branch up to date by merging its target branch into it — the inverse direction of a merge. This always produces a **merge commit** (first parent = the old head, second = the target tip) and never a rebase: the pull request's own commits, their change identities and every review-thread anchor are left untouched. Armed auto-merge survives the update, since an update introduces no newly authored content for a reviewer to re-approve. `outcome` is `already_up_to_date` when the target was already contained in the head (nothing is published), or `updated` with the new head. Returns 409 when the merge conflicts, when the branch has no commits of its own (updating it would empty the pull request), when the source branch lives in a fork, or when `expected_head` no longer matches the current head. Requires write access.
Requires authentication using a bearer token or a session cookie — see tokens and scopes.
curl
curl -X POST 'https://neosource.dev/api/repos/OWNER/REPO/pulls/NUMBER/update-branch' \
-H 'Authorization: Bearer $NEOSOURCE_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'fetch
fetch("https://neosource.dev/api/repos/OWNER/REPO/pulls/NUMBER/update-branch", {
method: "POST",
headers: {
Authorization: "Bearer $NEOSOURCE_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});neo
neo pr update-branch NUMBER OWNER/REPOPath parameters
ownerrequiredRepository owner or organization slug.
reporequiredRepository name.
numberrequiredChange request number.
Request bodyrequired
application/json
Responses
200Branch updated, or already up to date
application/json
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 401Authentication required
- 403Forbidden — one of: forbidden
- 404Not Found — one of: not_found
- 409Conflict — one of: already_exists, conflict, non_fast_forward, github_sync_active
- 423Locked — one of: busy
- 429Rate limited — retry after the `Retry-After` header
- 500Internal server error
- 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
- 504Gateway timeout — the request exceeded the server's handling budget