git.commits.get

Show one commit with its patch

GET /git/api/repositories/{repoId}/commits/{sha}IAM git:PullRepositoryReadSensitive read, audited

Sensitive read — a patch is source code.

Request syntax

GET /git/api/repositories/{repoId}/commits/{sha}

Path parameters

  • repoIdRequired

    string

    Constraints: uuid

  • shaRequired

    string

    Constraints: 1-255 chars

Response

200 with the commit's metadata (as in `list`), `files` (filename, status, additions, deletions, patch) and `stats` (additions, deletions).

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Fields of data

  • oidAlways

    string

    The full 40-character commit id
  • shortOidAlways

    string

    The abbreviated commit id
  • subjectAlways

    string

    The first line of the commit message
  • bodyAlways

    string

    The rest of the commit message; empty when there is none
  • authorNameAlways

    string

    Who wrote the commit
  • authorEmailAlways

    string

    The author's email address
  • authoredAtAlways

    string

    When the commit was authored (ISO 8601)
  • parentsAlways

    array of string

    Ids of the parent commits: none for the first commit, two or more for a merge
  • filesAlways

    array of object

    Every file the commit changed
  • files[].​filenameAlways

    string

    The file's path after the commit (the new path of a rename)
  • files[].​statusAlways

    one of added, modified, deleted, renamed

    What the commit did to the file
  • files[].​additionsAlways

    number

    Lines added (0 for a binary file)
  • files[].​deletionsAlways

    number

    Lines removed (0 for a binary file)
  • files[].​patchWhen present

    string

    The file's unified diff; absent when there is none to show (e.g. too large)
  • statsAlways

    object

    Totals over the changed files
  • stats.​additionsAlways

    number

    Lines added across all files
  • stats.​deletionsAlways

    number

    Lines removed across all files

Checked against the handlers: every route test validates their answers against this schema.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow git:PullRepository on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud git commits get repoId sha

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_git_commits_get.