Skip to content

Retrieve a commit diff

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

Retrieves the diff of a commit in a project.

id
required
One of:
string

The ID or URL-encoded path of the project

sha
required
string

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

page
integer
default: 1 nullable

Current page number

Example
1
per_page
integer
default: 20 nullable

Number of items per page

Example
20
unidiff
boolean
nullable

A diff in a Unified diff format

OK

Media type application/json
object
diff
string
collapsed
boolean
too_large
boolean
new_path
string
old_path
string
a_mode
string
b_mode
string
new_file
boolean
renamed_file
boolean
deleted_file
boolean
generated_file
boolean
Example
{
"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"
}

Bad Request

Not found