---
title: "Update a Branch"
method: PATCH
path: "/spaces/{spaceId}/branches/{branchId}"
tags: ["Manage Branches"]
---

# Update a Branch

`PATCH /spaces/{spaceId}/branches/{branchId}`

Update the ID or the baseRef of a branch. Changing the base reference of a branch performs a "rebase"-operation. Under some circumstances such an operation can take a bit longer than usual, in that case a special response will be sent which contains a token to check the status of the operation.
Depending on the content of the branch, there can be conflicts during a "rebase"-operation. In that case the response will be a conflict-response which contains a description of the occurred conflicts. These conflicts then have to be solved in order to continue with the "rebase"-operation.

## Path parameters

- `spaceId` string, required
- `branchId` string, required

## Request body

- Branch — A branch is like a separate space, which is based on a specific version of the space or on a specific version of some other branch of the space. Reading & writing features to a branch does not have an effect on the main branch or any other branch of the space. A branch can be created by pointing to a base ref. A base ref consists of the base branch (e.g, "main") and the base version of that base branch. New write transactions to the created branch will continue to increase the version counter starting from the base version. Versions in that branch are independent from the versions of the base branch.
  - `id` string — The branch ID. It must be unique per space.
  - `baseRef` string — The reference onto which the branch has been created. A reference describes a target branch and a version within that target branch. References have the following syntax: `[<branchName (optional, default: main)>:][<version (optional, default: HEAD)>]` The "main"-branch is the space itself as it has been created in the first place. Defining the branch as part of the reference only becomes necessary if further branches have been created for the space, which should be addressed by the ref. Samples: - `main:42` points to version 42 of the "main"-branch - `myBranch:37` Points to version 37 of the branch with ID "myBranch" - `42` points to version 42 of the "main"-branch - `myBranch:HEAD` points to the latest version of the branch with ID "myBranch" - `HEAD` points to the latest version of the "main"-branch - `myBranch` points to the latest version of the branch with ID "myBranch"

## Response `200`

A branch response.

- Branch — A branch is like a separate space, which is based on a specific version of the space or on a specific version of some other branch of the space. Reading & writing features to a branch does not have an effect on the main branch or any other branch of the space. A branch can be created by pointing to a base ref. A base ref consists of the base branch (e.g, "main") and the base version of that base branch. New write transactions to the created branch will continue to increase the version counter starting from the base version. Versions in that branch are independent from the versions of the base branch.
  - `id` string — The branch ID. It must be unique per space.
  - `baseRef` string — The reference onto which the branch has been created. A reference describes a target branch and a version within that target branch. References have the following syntax: `[<branchName (optional, default: main)>:][<version (optional, default: HEAD)>]` The "main"-branch is the space itself as it has been created in the first place. Defining the branch as part of the reference only becomes necessary if further branches have been created for the space, which should be addressed by the ref. Samples: - `main:42` points to version 42 of the "main"-branch - `myBranch:37` Points to version 37 of the branch with ID "myBranch" - `42` points to version 42 of the "main"-branch - `myBranch:HEAD` points to the latest version of the branch with ID "myBranch" - `HEAD` points to the latest version of the "main"-branch - `myBranch` points to the latest version of the branch with ID "myBranch"

## Other responses

- `400` — Malformed or Bad Request.
- `401` — Unauthorized to perform the request.
- `403` — Forbidden request. Insufficient rights to perform the request.
- `404` — Not found.

---

[API](https://skmtc.net/here/apis/here-xyz-hub.md) · [All operations](https://skmtc.net/here/apis/here-xyz-hub/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/here/here-xyz-hub/revisions/1c6c6a2bcac9/schema)
