---
title: "Revert a commit in the local repository"
method: POST
path: "/version/revert"
tags: ["versioning"]
---

# Revert a commit in the local repository

`POST /version/revert`

Revert a commit in the local repository by creating a new commit that undoes the changes introduced by the specified commit.<br/><br/>Use the <code>force</code> field to proceed even when the working directory is not clean.

## Request body

- GitRevertParams
  - `commit` string, required — SHA-1 hash of the commit to revert.
  - `force` boolean — If <code>true</code>, force the revert even when the working directory is not clean. Otherwise, <code>false</code>.
  - `message` string — Custom message to use for the revert commit. If omitted, a default message is generated.

## Response `200`

The created GitRevertResult object in a single-item list.

- CountedGitRevertResult
  - `count` integer, required — number of items present in the items array
  - `items` GitRevertResult[], required — List of items in this response.
    - `audit` object, required — Audit record for the revert operation, including the commit hash and affected files.
      - `files` object — Files affected by the revert, grouped by change type.
        - `created` string[] — Array of file paths that were created in the commit.
        - `deleted` string[] — Array of file paths that were deleted in the commit.
        - `modified` string[] — Array of file paths that were modified in the commit.
        - `renamed` GitFileRename[] — Array of file rename operations, each containing the original path and the new path.
          - `from` string, required — Original file path before the rename.
          - `to` string, required — New file path after the rename.
      - `group` string — Worker Group the revert was applied to, if applicable.
      - `id` string, required — SHA-1 hash of the revert commit that was created.
    - `reverted` boolean, required — If <code>true</code>, the revert was applied successfully. Otherwise, <code>false</code>.

## Other responses

- `401` — Authentication failed (missing or invalid credentials or Bearer token).
- `500` — Unexpected server error.

---

[API](https://skmtc.dev/criblio/apis/cribl-api-reference.md) · [All operations](https://skmtc.dev/criblio/apis/cribl-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/criblio/cribl-api-reference/revisions/56cb25079271/schema)
