---
title: "Rebase branch"
method: POST
path: "/api/projects/{projectId}/branches/{branchId}/rebase"
tags: ["Branches"]
---

# Rebase branch

`POST /api/projects/{projectId}/branches/{branchId}/rebase`

Rebases a branch onto the latest main branch commit.

## Path parameters

- `projectId` string, uuid, required
- `branchId` union, required
  - string, uuid
  - 'main'

## Request body

- object
  - `resolutions` object[] — Conflict resolutions for rebasing
    - `path` string, required
    - `resolution` 'useLeft' | 'useRight' | 'manual', required
    - `content` unknown
    - `hash` string

## Response `200`

Rebase result

- object — Rebase result
  - `success` boolean, required — Whether the rebase was successful
  - `newBaseCommitId` string, uuid, required — ID of the new base commit
  - `newCommitId` string, uuid — ID of the new commit created by rebase
  - `message` string, required — Human-readable result message
  - `stats` object — Rebase statistics
    - `filesChanged` number, required — Number of files changed
    - `conflictsResolved` number, required — Number of conflicts resolved

---

[API](https://skmtc.dev/gorules/apis/gorules-agent-api.md) · [All operations](https://skmtc.dev/gorules/apis/gorules-agent-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gorules/gorules-agent-api/revisions/52c0773fcd80/schema)
