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

# Commit branch changes

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Commits a branch's uncommitted changes and pushes them to the branch on GitHub. This works on apps imported from GitHub.

Send the branch as `branch_id`, or leave it out for the main branch. The call runs in that branch's environment. If the environment isn't running, the call starts it first, which can take a few minutes. Changes on the repository's default branch can't be committed: create a branch with [Create branch](/api-reference/create-branch) and commit there. `message` sets the commit message, `Manual commit from Base44` by default. The request waits for the push, and returns the branch's new git state.

On some apps, an AI model first reviews the changes against the branch's chat, which makes the call slower. It commits only the changes that belong to the branch's feature, and keeps the rest uncommitted in the app's preview. When none of the changes clearly belong, the call is refused with `commit_review_required` and nothing is committed: describe the changes to the AI in the app's chat, then retry. Committing with no changes returns the current state, so you can retry safely.

This endpoint is limited to 10 requests per minute per user, shared with Discard branch changes, Revert branch file changes, Open pull request and Update pull request, and reported in the `X-RateLimit-*` headers.

<Note>This endpoint accepts a personal API key or personal access token belonging to a user with editor access to the app. A read-only key is refused, and workspace API keys are not accepted. Send credentials in a header: an `api_key` query parameter is refused.</Note>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json post /api/apps/{app_id}/imported/git/commit
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/imported/git/commit:
    post:
      summary: Commit branch changes
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Commits a branch's uncommitted changes and pushes them to the branch on
        GitHub. This works on apps imported from GitHub.


        Send the branch as `branch_id`, or leave it out for the main branch. The
        call runs in that branch's environment. If the environment isn't
        running, the call starts it first, which can take a few minutes. Changes
        on the repository's default branch can't be committed: create a branch
        with [Create branch](/api-reference/create-branch) and commit there.
        `message` sets the commit message, `Manual commit from Base44` by
        default. The request waits for the push, and returns the branch's new
        git state.


        On some apps, an AI model first reviews the changes against the branch's
        chat, which makes the call slower. It commits only the changes that
        belong to the branch's feature, and keeps the rest uncommitted in the
        app's preview. When none of the changes clearly belong, the call is
        refused with `commit_review_required` and nothing is committed: describe
        the changes to the AI in the app's chat, then retry. Committing with no
        changes returns the current state, so you can retry safely.


        This endpoint is limited to 10 requests per minute per user, shared with
        Discard branch changes, Revert branch file changes, Open pull request
        and Update pull request, and reported in the `X-RateLimit-*` headers.


        <Note>This endpoint accepts a personal API key or personal access token
        belonging to a user with editor access to the app. A read-only key is
        refused, and workspace API keys are not accepted. Send credentials in a
        header: an `api_key` query parameter is refused.</Note>
      operationId: commit_changes_api_apps__app_id__imported_git_commit_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app.
            title: App Id
          description: ID of the app.
          example: 6820f3a4e7b91d003c45a1f2
        - name: branch_id
          in: query
          required: false
          schema:
            type: string
            description: >-
              ID of the branch to work on, as returned by [List
              branches](/api-reference/list-branches). Omit it to work on the
              app's main branch.
            title: Branch Id
          description: >-
            ID of the branch to work on, as returned by [List
            branches](/api-reference/list-branches). Omit it to work on the
            app's main branch.
          example: 68f1a2b3c4d5e6f708192a3b
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommitRequest'
      responses:
        '200':
          description: The branch's git state after the push.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchGitStatus'
              example:
                current_branch: feature/checkout
                default_branch: main
                base_branch: main
                head: 9fceb02d0ae598e95dc970b74767f19372d61af8
                head_committed_at: '2026-10-28T09:15:00Z'
                dirty: false
                dirty_files: []
                ahead: 0
                behind: 0
                merge_in_progress: false
        '401':
          description: >-
            `unauthenticated`: Missing or invalid credentials, or credentials
            sent as an `api_key` query parameter.
          content:
            application/json:
              examples:
                unauthenticated:
                  summary: unauthenticated
                  value:
                    error:
                      code: unauthenticated
                      message: 'Use Authorization: Bearer credentials.'
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '403':
          description: >-
            `forbidden`: You don't have editor access to this app, your API key
            is read-only, or you used a workspace API key.
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    error:
                      code: forbidden
                      message: You don't have editor access to this app.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '404':
          description: >-
            `not_found`: The app or `branch_id` doesn't exist, or the app isn't
            imported from GitHub.
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    error:
                      code: not_found
                      message: Branch not found
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '409':
          description: >-
            `default_branch_immutable`: The changes are on the repository's
            default branch. `commit_review_required`: None of the changes
            clearly belong to the branch's feature; describe them to the AI in
            the app's chat and retry. `git_commit_failed`: The commit couldn't
            be pushed; retry. `git_status_failed`: The state couldn't be read;
            retry shortly. `app_processing`: The AI is working on the app; wait
            for it to finish. `git_busy`: Another git operation is running on
            the branch; retry shortly. `branch_scope_read_only`: The branch is
            merged or closed. `branch_sync_in_progress`: A conflict resolution
            is waiting on the branch. `branch_protected`: Main is protected;
            work on a branch. `sandbox_unavailable`: The branch's environment
            couldn't start. `github_workspace_connection_required`: The
            repository isn't connected to GitHub in the app's workspace.
          content:
            application/json:
              examples:
                default_branch_immutable:
                  summary: default_branch_immutable
                  value:
                    error:
                      code: default_branch_immutable
                      message: >-
                        Changes on the default branch can't be committed
                        directly. Create a branch and work there.
                      details:
                        reason: default_branch_immutable
                commit_review_required:
                  summary: commit_review_required
                  value:
                    error:
                      code: commit_review_required
                      message: >-
                        Some edits need clarification before they can be
                        committed. They remain in your preview. Describe how
                        they relate to your feature and try again.
                      details: {}
                app_processing:
                  summary: app_processing
                  value:
                    error:
                      code: app_processing
                      message: >-
                        App is still generating - wait for the current turn to
                        finish before committing changes
                      details:
                        reason: app_processing
                        operation: committing changes
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '422':
          description: >-
            `invalid_request`: The body isn't valid JSON or `message` isn't a
            string.
          content:
            application/json:
              examples:
                invalid_request:
                  summary: invalid_request
                  value:
                    error:
                      code: invalid_request
                      message: Invalid request
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '429':
          description: >-
            `rate_limited`: More than 10 requests in a minute. Retry after
            `Retry-After` seconds.
          content:
            application/json:
              examples:
                rate_limited:
                  summary: rate_limited
                  value:
                    error:
                      code: rate_limited
                      message: Rate limit exceeded.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
      security:
        - PersonalAccessTokenAuth:
            - full_access
components:
  schemas:
    CommitRequest:
      properties:
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: Commit message. Defaults to `Manual commit from Base44`.
          example: Add checkout page
      type: object
      title: CommitRequest
    BranchGitStatus:
      properties:
        current_branch:
          type: string
          title: Current Branch
          description: >-
            Branch checked out in the branch's environment, or `HEAD` when none
            is checked out.
          example: feature/checkout
        default_branch:
          type: string
          title: Default Branch
          description: The repository's default branch on GitHub.
          example: main
        base_branch:
          type: string
          title: Base Branch
          description: The branch the app was imported from. Pull requests merge into it.
          example: main
        head:
          anyOf:
            - type: string
            - type: 'null'
          title: Head
          description: SHA of the latest commit, or `null` when the branch has no commits.
          example: 9fceb02d0ae598e95dc970b74767f19372d61af8
        head_committed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Head Committed At
          description: >-
            When the latest commit was made, as an ISO 8601 UTC timestamp, or
            `null`.
          example: '2026-10-28T09:15:00Z'
        dirty:
          type: boolean
          title: Dirty
          description: Whether there are uncommitted changes.
          example: true
        dirty_files:
          items:
            type: string
          type: array
          title: Dirty Files
          description: >-
            Paths of the first 20 files with uncommitted changes. A renamed file
            reads `old -> new`.
          example:
            - src/pages/Checkout.jsx
        ahead:
          anyOf:
            - type: integer
            - type: 'null'
          title: Ahead
          description: >-
            Commits not pushed to GitHub yet, or `null` when the branch isn't on
            GitHub.
          example: 1
        behind:
          anyOf:
            - type: integer
            - type: 'null'
          title: Behind
          description: >-
            Commits on GitHub the environment doesn't have yet, as of its last
            fetch, or `null` when the branch isn't on GitHub.
          example: 0
        merge_in_progress:
          type: boolean
          title: Merge In Progress
          description: >-
            Whether a merge is under way, for example while conflicts are
            resolved.
          example: false
      type: object
      required:
        - current_branch
        - default_branch
        - base_branch
        - head
        - head_committed_at
        - dirty
        - dirty_files
        - ahead
        - behind
        - merge_in_progress
      title: BranchGitStatus
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.