commits

Retrieve a commit diff

Retrieves the diff of a commit in a project.

get/api/v4/projects/{id}/repository/commits/{sha}/diff

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project

shastring required

A commit sha, or the name of a branch or tag

Query parameters

pageinteger

Current page number

per_pageinteger

Number of items per page

unidiffboolean

A diff in a Unified diff format

Response

Retrieve a commit diff

diffstring required
collapsedboolean required
too_largeboolean required
new_pathstring required
old_pathstring required
a_modestring required
b_modestring required
new_fileboolean required
renamed_fileboolean required
deleted_fileboolean required
generated_fileboolean required

Example response

[
  {
    "diff": "@@ -71,6 +71,8 @@\\n...",
    "new_path": "doc/update/5.4-to-6.0.md",
    "old_path": "doc/update/5.4-to-6.0.md",
    "a_mode": "100755",
    "b_mode": "100644"
  }
]

Changes

No recorded changes to this operation across all 5 revisions of this API.