> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diversion.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Revert commit

> 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.




## OpenAPI

````yaml post /repos/{repo_id}/revert
openapi: 3.0.3
info:
  title: Diversion Core API
  description: >-
    Definition of the Core API used to access low-level functionality of
    Diversion
  version: 0.2.0
servers:
  - url: https://api.diversion.dev/v0
    description: Base endpoint
security: []
paths:
  /repos/{repo_id}/revert:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
    post:
      tags:
        - Repository Commit Manipulation
      summary: Revert commit
      description: >
        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.
      operationId: src.handlersv2.revert.revert
      parameters:
        - $ref: '#/components/parameters/BaseRefParam'
          required: true
        - $ref: '#/components/parameters/RevertRefParam'
          required: true
      responses:
        '200':
          $ref: '#/components/responses/OKEmpty'
          description: The revert was empty
        '201':
          description: >-
            The revert was completed successfully, and the response contains the
            new commit ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NewResourceId'
        '202':
          description: >-
            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}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeId'
      security:
        - OAuth2:
            - coreapi/write
components:
  parameters:
    RepoParam:
      in: path
      name: repo_id
      required: true
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      description: >-
        The repo ID of the repository. Repo _name_ can be used instead of the
        ID, but usage of ID for permanent linking and API requests is preferred.
    BaseRefParam:
      in: query
      name: base_id
      description: A reference to a base unto which changes will be applied
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
    RevertRefParam:
      in: query
      name: revert_ref_id
      description: >-
        A reference to a source version to revert, currently only commit ID is
        supported
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
  responses:
    OKEmpty:
      description: Request completed successfully
  schemas:
    NewResourceId:
      type: object
      properties:
        id:
          type: string
          description: The id of the newly created resource
          example: example_id
      required:
        - id
    MergeId:
      type: object
      properties:
        merge_id:
          type: string
          example: example_id
          minLength: 3
          maxLength: 128
      required:
        - merge_id
  securitySchemes:
    OAuth2:
      type: oauth2
      x-tokenInfoFunc: src.token_info.token_auth
      description: This API uses OAuth 2 with the implicit grant flow
      flows:
        implicit:
          authorizationUrl: https://auth.diversion.dev/oauth2/authorize
          scopes:
            coreapi/read: Operations with no possible side-effects
            coreapi/write: Modifying operations
            coreapi/admin: >-
              Organizational operations like adding a repo or changing repo
              properties

````