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

# Cherry-pick commit

> Cherry-picks changes from a specific commit (identified by `ref_id`) into the current workspace.

**Process:**
- Creates a temporary patch from the source commit
- Applies it to the workspace
- If conflicts occur, returns a merge ID that must be resolved before proceeding

**Requirements:**
Requires WRITE access.

**Returns:**
- `404 Not Found` if the reference doesn't exist
- `202 Accepted` with merge_id if conflicts occurred
- `204 No Content` on clean application




## OpenAPI

````yaml post /repos/{repo_id}/workspaces/{workspace_id}/cherry-pick
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}/workspaces/{workspace_id}/cherry-pick:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
      - $ref: '#/components/parameters/WorkspaceParam'
    post:
      tags:
        - Repository Workspace Manipulation
      summary: Cherry-pick commit
      description: >
        Cherry-picks changes from a specific commit (identified by `ref_id`)
        into the current workspace.


        **Process:**

        - Creates a temporary patch from the source commit

        - Applies it to the workspace

        - If conflicts occur, returns a merge ID that must be resolved before
        proceeding


        **Requirements:**

        Requires WRITE access.


        **Returns:**

        - `404 Not Found` if the reference doesn't exist

        - `202 Accepted` with merge_id if conflicts occurred

        - `204 No Content` on clean application
      operationId: src.handlersv2.workspace.cherry_pick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ref_id:
                  type: string
                  description: The commit to cherry-pick
                  minLength: 7
                  maxLength: 128
              required:
                - ref_id
      responses:
        '202':
          description: >-
            The cherry-pick is in progress. It has 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'
        '204':
          $ref: '#/components/responses/OKEmpty'
        default:
          $ref: '#/components/responses/Error'
      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.
    WorkspaceParam:
      in: path
      name: workspace_id
      required: true
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      description: The repo ID of the workspace.
  schemas:
    MergeId:
      type: object
      properties:
        merge_id:
          type: string
          example: example_id
          minLength: 3
          maxLength: 128
      required:
        - merge_id
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
  responses:
    OKEmpty:
      description: Request completed successfully
    Error:
      description: An error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  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

````