GitLab API icon

GitLab API

Gitlab

Actions1062

Commits → getApiV4ProjectsIdRepositoryCommitsShaDiff

AI-generated

Summary

Retrieve the diff information for a specific commit identified by a commit SHA (or branch/tag name) in a given GitLab project.

Inputs

  • id (required) — The ID or URL-encoded path of the GitLab project whose commit diff is to be fetched.
  • sha (required) — The commit SHA or the name of a branch or tag representing the commit for which the diff is requested.
  • page — The page number for paginated results, defaults to 1.
  • per_page — The number of diff items to return per page, defaults to 20.
  • unidiff — Option to request the diff in Unified diff format (boolean). Default is false.

Output shape

a list of diff objects representing changes introduced in the specified commit

Results may be paginated using the 'page' and 'per_page' query parameters. The 'unidiff' flag alters the diff format returned. Authentication is required unless 'Skip Authentication' is enabled.

Examples

Example 1: Fetch commit diff with default pagination

Provide 'id' and 'sha' values; other query parameters left empty or default.

Example 2: Fetch commit diff in unified diff format

Set 'unidiff' to true along with required 'id' and 'sha'.

Links

Discussion