Canonical: https://weaveos.com/reference/gitlab/read-merge-request-diff

1. [Software capabilities](https://weaveos.com/reference)
2. /[GitLab](https://weaveos.com/reference/gitlab)
3. /Read a GitLab merge request diff

GitLab capability

# Read a GitLab 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.

Documentation reviewed November 26, 2026

## Ways to do it

API

### GET /projects/{id}/merge\_requests/{merge\_request\_iid}/diffs

Read per-file changes, paths, and flags for added, removed, or renamed files.

- Requirements

  Project ID or URL-encoded path, project-scoped merge request IID, and API read access.

- Limitations

  GitLab can omit diff content for files marked collapsed or too\_large. A file entry alone doesn’t guarantee its changes are present.

[Read source: GitLab Merge Requests API list diffs ↗](https://docs.gitlab.com/api/merge_requests/#list-merge-request-diffs)

CLI

### glab mr diff \<iid> --raw

Print a merge request’s raw diff for a patch tool or another script.

- Requirements

  glab authenticated to the project and the merge request IID or branch.

- Limitations

  The raw output is a patch. Use the API when the program needs per-file metadata as JSON.

Example

```
glab mr diff "$MR_IID" --repo "$PROJECT_PATH" --raw
```

[Read source: GitLab CLI mr diff ↗](https://docs.gitlab.com/cli/mr/diff/)

## More from GitLab

[View all GitLab capabilities →](https://weaveos.com/reference/gitlab)

- [Read GitLab CI job logs↗](https://weaveos.com/reference/gitlab/read-ci-job-logs)
- [List pipelines in a GitLab project↗](https://weaveos.com/reference/gitlab/list-project-pipelines)
- [Download GitLab CI job artifacts↗](https://weaveos.com/reference/gitlab/download-ci-job-artifacts)
