Skip to content

Sync a fork branch with the upstream repository

POST
/repos/{owner}/{repo}/merge-upstream

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

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

Media type application/json
object
branch
required

The name of the branch which should be updated to match upstream.

string
Examples
Example default
{
"branch": "main"
}

The branch has been successfully synced with the upstream repository

Media type application/json
Merged upstream

Results of a successful merge upstream request

object
message
string
merge_type
string
Allowed values: merge fast-forward none
base_branch
string
Examples
Example default
{
"message": "Successfully fetched and fast-forwarded from upstream defunkt:main",
"merge_type": "fast-forward",
"base_branch": "defunkt:main"
}

The branch could not be synced because of a merge conflict

The branch could not be synced for some other reason