> ## Documentation Index
> Fetch the complete documentation index at: https://allhandsai-chore-regenerate-agent-sdk-openapi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Git Diff Query

> Get git diff using query parameter (preferred method).



## OpenAPI

````yaml /openapi/agent-sdk.json get /api/git/diff
openapi: 3.1.0
info:
  description: OpenHands Agent Server - REST/WebSocket interface for OpenHands AI Agent
  title: OpenHands Agent Server
  version: 1.52.0
servers: []
security: []
paths:
  /api/git/diff:
    get:
      tags:
        - Git
      summary: Git Diff Query
      description: Get git diff using query parameter (preferred method).
      operationId: git_diff_query_api_git_diff_get
      parameters:
        - description: The file path to get diff for
          in: query
          name: path
          required: true
          schema:
            description: The file path to get diff for
            title: Path
            type: string
        - description: >-
            Optional git ref to diff against (e.g. 'HEAD' for git status-style
            changes, or a commit hash). When omitted, the upstream/default
            branch is auto-detected.
          in: query
          name: ref
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Optional git ref to diff against (e.g. 'HEAD' for git status-style
              changes, or a commit hash). When omitted, the upstream/default
              branch is auto-detected.
            title: Ref
        - description: >-
            Optional commit SHA. When set, the diff is the change that commit
            introduced (vs its first parent), read entirely from git objects so
            deleted files still render. Mutually exclusive with 'ref'.
          in: query
          name: commit
          required: false
          schema:
            anyOf:
              - pattern: ^[0-9a-fA-F]{4,64}$
                type: string
              - type: 'null'
            description: >-
              Optional commit SHA. When set, the diff is the change that commit
              introduced (vs its first parent), read entirely from git objects
              so deleted files still render. Mutually exclusive with 'ref'.
            title: Commit
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GitDiff'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
components:
  schemas:
    GitDiff:
      properties:
        modified:
          anyOf:
            - type: string
            - type: 'null'
          title: Modified
        original:
          anyOf:
            - type: string
            - type: 'null'
          title: Original
      required:
        - modified
        - original
      title: GitDiff
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-Session-API-Key
      type: apiKey

````

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