> ## 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 base branch

> Fast-forwards a workspace to incorporate the latest changes from its base branch.

**Conflict handling:**
When explicitly requested by users, conflicts are created and returned as a merge ID for manual resolution. This ensures the workspace is up-to-date with the branch before committing.

**Returns:**
- `412 Precondition Failed` if the workspace is detached
- `503 Service Unavailable` if a dependent service is unavailable
- `202 Accepted` with merge_id if conflicts occurred
- `200 OK` if changes were applied
- `204 No Content` if already up-to-date




## OpenAPI

````yaml post /repos/{repo_id}/workspaces/{workspace_id}/forward
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}/forward:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
      - $ref: '#/components/parameters/WorkspaceParam'
    post:
      tags:
        - Repository Workspace Manipulation
      summary: Merge base branch into workspace
      operationId: src.handlersv2.workspace.forward_workspace
      responses:
        '200':
          $ref: '#/components/responses/OKEmpty'
          description: The merge into a workspace was completed successfully
        '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'
        '204':
          $ref: '#/components/responses/OKEmpty'
          description: >-
            Base ref is already up to date with the other ref, no action was
            made
        '412':
          description: Workspace is detached
      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.
  responses:
    OKEmpty:
      description: Request completed successfully
  schemas:
    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

````