---
title: "Sync a fork branch with the upstream repository"
method: POST
path: "/repos/{owner}/{repo}/merge-upstream"
tags: ["repos"]
---

# 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.

## Path parameters

- `owner` string, required
- `repo` string, required

## Request body

- object
  - `branch` string, required — The name of the branch which should be updated to match upstream.

## Response `200`

The branch has been successfully synced with the upstream repository

- MergedUpstream — Results of a successful merge upstream request
  - `message` string
  - `merge_type` 'merge' | 'fast-forward' | 'none'
  - `base_branch` string

## Other responses

- `409` — The branch could not be synced because of a merge conflict
- `422` — The branch could not be synced for some other reason

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
