Sample - GitHub REST API
POST/repos/{owner}/{repo}/merge-upstream

Sync a fork branch with the upstream repository

Sync a branch of a forked repository to keep it up-to-date with the upstream repository.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 1 body field
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
branchstringrequired
The name of the branch which should be updated to match upstream.

3 status codes
200The branch has been successfully synced with the upstream repository
messagestringoptional
merge_typestringoptional
Allowed:mergefast-forwardnone
base_branchstringoptional
409The branch could not be synced because of a merge conflict
422The branch could not be synced for some other reason

Error handling

A 409 is returned: The branch could not be synced because of a merge conflict. A 422 is returned: The branch could not be synced for some other reason.