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

# Rebase a branch onto a different parent branch (as a new branch)

> Replays this branch's changes onto a different base and returns the result as a NEW branch; the branch named in the path is not modified. The copy keeps this branch's value for every field it changed and resolves every field it did not from the new base. Its sub-branches, baselines, comments, and reviews are not copied. Refuses with 400 for the Base branch, a malformed id, a missing `newParentId`, or a target equal to the branch itself; 404 when either branch is not live in this project.



## OpenAPI

````yaml /openapi/customer-api.json post /project/{projectId}/branch/{id}/rebase-onto
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Flow customer API reference. Start with the [quickstart](/api/quickstart)
    and [authentication guide](/api/authentication).
  title: Customer API
  version: 1.0.0
servers:
  - description: Flow API
    url: https://backend.branch.flowengineering.com
security: []
tags:
  - name: Automations
  - name: Branches
  - name: Comments
  - name: Convert
  - name: Data Model
  - name: Diagrams
  - name: Entities
  - name: Files
  - name: Import
  - name: Notifications
  - name: Projects
  - name: ReqIF
  - name: ReqIF Import
  - name: Shared Access Grants
  - name: User Groups
  - name: Users
paths:
  /project/{projectId}/branch/{id}/rebase-onto:
    post:
      tags:
        - Branches
      summary: Rebase a branch onto a different parent branch (as a new branch)
      description: >-
        Replays this branch's changes onto a different base and returns the
        result as a NEW branch; the branch named in the path is not modified.
        The copy keeps this branch's value for every field it changed and
        resolves every field it did not from the new base. Its sub-branches,
        baselines, comments, and reviews are not copied. Refuses with 400 for
        the Base branch, a malformed id, a missing `newParentId`, or a target
        equal to the branch itself; 404 when either branch is not live in this
        project.
      operationId: BranchController_rebaseOnto
      parameters:
        - in: path
          name: projectId
          required: true
          schema:
            description: >-
              Project UUID, not a slug. Resolve a slug with GET
              /project/slug/{slug} using the same workspace and credentials,
              then pass the returned id.
            type: string
        - in: path
          name: id
          required: true
          schema:
            type: string
        - description: Workspace identifier
          in: header
          name: customer
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RebaseOntoBranchDto'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchCreatedDto'
          description: ''
      security:
        - api-key: []
        - bearer: []
components:
  schemas:
    RebaseOntoBranchDto:
      properties:
        name:
          description: Name for the new branch. Defaults to "<source name> (rebased)".
          type: string
        newParentId:
          description: >-
            Branch id to replay this branch onto. null (or "master") = the
            project Base.
          nullable: true
          type: string
      required:
        - newParentId
      type: object
    BranchCreatedDto:
      properties:
        id:
          type: string
        number:
          type: number
      required:
        - id
        - number
      type: object
  securitySchemes:
    api-key:
      in: header
      name: X-API-Key
      type: apiKey
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````