---
title: "Update a branch to a new commit"
method: PUT
path: "/api/repos/{namespace}/{repo_name}/branches/{branch_name}"
tags: ["Branches"]
---

# Update a branch to a new commit

`PUT /api/repos/{namespace}/{repo_name}/branches/{branch_name}`

## Request

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

Update a branch to point to a different commit ID.

## Path parameters

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

## Request body

- BranchUpdate
  - `commit_id` string, required

## Response `200`

Branch updated

- BranchResponse
  - `oxen_version` string, nullable
  - `status` string, required
  - `status_message` string, required
  - `branch` Branch, required
    - `commit_id` string, required
    - `name` string, required

## Other responses

- `400`: Bad Request
- `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)
