git.pulls.diff

Download the changes of a pull request as a diff or a patch

GET /git/api/repositories/{repoId}/pulls/{prNumber}/diffIAM git:PullRepositoryReadSensitive read, audited

Needs git:GetPullRequest as well: the pull request has to be readable, and its changes are source code. An open pull request is compared at the current tips of its branches, a merged or closed one at the commits recorded when it ended.

Request syntax

GET /git/api/repositories/{repoId}/pulls/{prNumber}/diff

Path parameters

  • repoIdRequired

    string

    Constraints: uuid

  • prNumberRequired

    number

    Constraints: integer, min 1

Query parameters

  • formatOptional

    enum

    `diff` (the default) is one unified diff; `patch` is the commits as an mbox, as `git format-patch` writes them, for `git am`

    One of: diff, patch

Response

200 with text/plain (UTF-8), not JSON: the unified diff of the source branch against its merge base with the target, or with `format=patch` the commits as an mbox. 404 for an unknown pull request, 422 when it has no commits to compare.

The response is the raw content with its own content type, not JSON.

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 pulls diff repoId prNumber

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