---
title: "Revert commit"
method: POST
path: "/repos/{repo_id}/revert"
tags: ["Repository Commit Manipulation"]
---

# Revert commit

`POST /repos/{repo_id}/revert`

## Request

- Base URL: `https://api.diversion.dev/v0`
- URL: `https://api.diversion.dev/v0/repos/{repo_id}/revert`
- Auth: OAuth 2
  - Implicit: `https://auth.diversion.dev/oauth2/authorize`
  - Scopes: `coreapi/write`
- TypeScript: <https://skmtc.dev/diversion/apis/diversion-core-api/docs/repos/:repo_id/revert/post.ts> (a function with typed inputs; its response is checked against the schema)

The operation reverts any changes done in the single commit represented by revert_ref_id (compared to its own parent). These opposing changes are then applied into the branch represented by base_id. If any changes were done between revert_ref_id and base_id, they will be checked for conflicts with the revert changes.

## Query parameters

- `base_id` string
- `revert_ref_id` string

## Response `200`

Request completed successfully

## Other responses

- `201`: The revert was completed successfully, and the response contains the new commit ID
- `202`: The revert is in progress. It has merge conflicts requiring active input from the user for conflict resolution. The response contains a merge ID, which can be used for querying /repos/{repo_id}/merges/{merge_id}

---

[API](https://skmtc.dev/diversion/apis/diversion-core-api.md) - [All operations](https://skmtc.dev/diversion/apis/diversion-core-api/llms.txt) - [OpenAPI document](https://skmtc.dev/diversion/apis/diversion-core-api/revisions/38a18aba804b?raw)
