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

# Get branch git status

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

Returns the git state of one of an imported app's branches: the checked-out branch, its latest commit, its uncommitted changes, and how far it is ahead of or behind 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.

This endpoint is limited to 60 requests per minute per user, shared with Get branch pull request, List pull request files and List branch file changes, 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 get /api/apps/{app_id}/imported/git/status
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/status:
    get:
      summary: Get branch git status
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Returns the git state of one of an imported app's branches: the
        checked-out branch, its latest commit, its uncommitted changes, and how
        far it is ahead of or behind 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.


        This endpoint is limited to 60 requests per minute per user, shared with
        Get branch pull request, List pull request files and List branch file
        changes, 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: get_status_api_apps__app_id__imported_git_status_get
      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
      responses:
        '200':
          description: The branch's git state.
          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: true
                dirty_files:
                  - src/pages/Checkout.jsx
                ahead: 1
                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: >-
            `git_status_failed`: The state couldn't be read; retry shortly.
            `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:
                git_status_failed:
                  summary: git_status_failed
                  value:
                    error:
                      code: git_status_failed
                      message: >-
                        Could not read the repository state. Try again in a
                        moment.
                      details: {}
                sandbox_unavailable:
                  summary: sandbox_unavailable
                  value:
                    error:
                      code: sandbox_unavailable
                      message: >-
                        The app environment is unavailable. Send a message to
                        the agent to bring it back up.
                      details:
                        reason: sandbox_unavailable
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '429':
          description: >-
            `rate_limited`: More than 60 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:
    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.