---
title: "Merge a commit into a branch"
method: POST
path: "/api/repos/{namespace}/{repo_name}/branches/{branch_name}/merge"
tags: ["Branches"]
---

# Merge a commit into a branch

`POST /api/repos/{namespace}/{repo_name}/branches/{branch_name}/merge`

## Request

- Base URL: `https://hub.oxen.ai`
- URL: `https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/branches/{branch_name}/merge`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/oxen/apis/oxen-server/docs/api/repos/:namespace/:repo_name/branches/:branch_name/merge/post.ts> (a function with typed inputs; its response is checked against the schema)

Merge a client commit into a branch during push. Returns merge commit on success, or original server commit if conflicts occur.

## Path parameters

- `namespace` string, required
- `repo_name` string, required
- `branch_name` string, required

## Request body

- BranchRemoteMerge
  - `client_commit_id` string, required
  - `server_commit_id` string, required

## Response `200`

Merge successful or merge conflicts encountered. Returns the new head commit.

- CommitResponse
  - `oxen_version` string, nullable
  - `status` string, required
  - `status_message` string, required
  - `commit` Commit, required
    - `author` string, required
    - `email` string, required
    - `id` string, required
    - `message` string, required
    - `parent_ids` string[], required
    - `timestamp` string, date-time, required

## Other responses

- `400`: Bad Request (e.g., malformed body)
- `404`: Branch or Commit not found

---

[API](https://skmtc.dev/oxen/apis/oxen-server.md) - [All operations](https://skmtc.dev/oxen/apis/oxen-server/llms.txt) - [OpenAPI document](https://skmtc.dev/oxen/apis/oxen-server/revisions/8021aa6fa5bc?raw)
