Canonical: https://weaveos.com/reference/github/read-pull-request-diff

1. [Software capabilities](https://weaveos.com/reference)
2. /[GitHub](https://weaveos.com/reference/github)
3. /Read a GitHub pull request diff

[![](https://weaveos.com/reference/logos/github.svg)GitHub](https://weaveos.com/reference/github)

# Read a GitHub pull request diff

Use the diff media type for a raw REST response. The GitHub CLI and GitHub MCP server can fetch the same pull request changes from a terminal or agent.

Documentation reviewed November 26, 2026 · 3 methods with sources

## Ways to do it

1. [1API: GET /repos/{owner}/{repo}/pulls/{pull\_number} with application/vnd.github.diff](https://weaveos.com/reference/github/read-pull-request-diff#method-1)
2. [2CLI: gh pr diff \<pull-request>](https://weaveos.com/reference/github/read-pull-request-diff#method-2)
3. [3MCP: pull\_request\_read with method=get\_diff](https://weaveos.com/reference/github/read-pull-request-diff#method-3)

API

### GET /repos/{owner}/{repo}/pulls/{pull\_number} with application/vnd.github.diff

Return the pull request’s diff as text using the Accept header.

[Read source: GitHub REST API get a pull request](https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request)

- Requirements

  Repository owner, name, and pull request number. A fine-grained token for a private repository needs Pull requests read permission.

- Limitations

  A large diff can time out and return HTTP 5xx.

CLI

### gh pr diff \<pull-request>

Print the pull request diff. Use --name-only to list files or --patch to request patch format.

[Read source: GitHub CLI pull request diff](https://cli.github.com/manual/gh_pr_diff)

- Requirements

  GitHub CLI authenticated for the repository and a pull request reference.

- Limitations

  Using --name-only omits the changed lines.

Example shell

Copy

```
gh pr diff "$PR_NUMBER" --repo "$OWNER/$REPO" --color never
```

MCP

### pull\_request\_read with method=get\_diff

Give an MCP client the owner, repository, and pull request number to retrieve its diff.

[Read source: GitHub MCP server tools](https://github.com/github/github-mcp-server#tools)

- Requirements

  GitHub MCP server with the pull request read tool enabled and repository access.

- Limitations

  Available only if the connected server exposes the tool or method. Check the client’s tool list before relying on it.

[Previous GitHub taskList GitHub Actions workflow runs](https://weaveos.com/reference/github/list-actions-workflow-runs) [Next GitHub task Download GitHub Actions artifacts](https://weaveos.com/reference/github/download-actions-artifacts)

## More from GitHub

[View all 5 GitHub tasks](https://weaveos.com/reference/github)

- ### [Read GitHub Actions job logs](https://weaveos.com/reference/github/read-actions-job-logs)

  GitHub’s MCP server can read Actions job logs when the Actions toolset is available. Use the REST endpoint to download one job’s log, or use gh or the Actions page to inspect a failure by step.

  API, MCP, CLI, Interface

- ### [Read checks on a GitHub pull request](https://weaveos.com/reference/github/read-pull-request-checks)

  Use gh pr checks for a pull request’s check summary. Use the Checks API for structured check runs on a specific commit.

  API, CLI

## The same task in other apps

- [![](https://weaveos.com/reference/logos/gitlab.svg)GitLab](https://weaveos.com/reference/gitlab)

  ### [Read a GitLab merge request diff](https://weaveos.com/reference/gitlab/read-merge-request-diff)

  Use the Merge Requests API to get diffs and metadata by file. Use glab mr diff --raw when a patch tool needs the original patch format.

  API, CLI

- [![](https://weaveos.com/reference/logos/bitbucket.svg)Bitbucket Cloud](https://weaveos.com/reference/bitbucket)

  ### [List open pull requests in Bitbucket Cloud](https://weaveos.com/reference/bitbucket/list-open-pull-requests)

  List open pull requests for a repository with the Bitbucket API, or browse them in the Atlassian extension for VS Code. Use the API’s state filter when a report also needs merged or declined pull requests.

  API, Interface

- [![](https://weaveos.com/reference/logos/cloudflare.svg)Cloudflare](https://weaveos.com/reference/cloudflare)

  ### [Update or overwrite a DNS record](https://weaveos.com/reference/cloudflare/update-dns-record)

  Update an existing DNS record with PATCH or overwrite it with PUT. The TypeScript client exposes these operations as edit and update, respectively.

  API, SDK
