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

# Merge refs

> Merge branch / workspace / commit into target branch



## OpenAPI

````yaml post /repos/{repo_id}/merges
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}/merges:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
    post:
      tags:
        - Repository Merge Manipulation
      summary: Merge ref into a branch
      operationId: src.handlersv2.merge.post
      parameters:
        - $ref: '#/components/parameters/BaseRefParam'
          required: true
          description: A branch or workspace ID
        - $ref: '#/components/parameters/OtherRefParam'
          required: true
          description: A commit or branch ID
      responses:
        '200':
          $ref: '#/components/responses/OKEmpty'
          description: >-
            Base ref is already up to date with the other ref, no action was
            made
        '201':
          description: >-
            The merge into a branch was completed successfully, and the response
            contains the new commit ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NewResourceId'
        '202':
          description: >-
            The merge 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
    OtherRefParam:
      in: query
      name: other_id
      description: A reference to a source version from which changes will be taken
      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

````