GitLab API

GitlabTool

Actions1095

Branches → getApiV4ProjectsIdRepositoryBranchesBranch

AI-generated

Summary

Retrieve details of a specific branch in a GitLab project using the GitLab API's endpoint for repository branches.

Inputs

  • Id (required) — The ID or URL-encoded path of the GitLab project.
  • Branch (required) — The name of the branch within the specified project to retrieve.
  • Skip Authentication — Optionally skip using authentication for the request (default is false).
  • baseUrl — The base URL of the GitLab instance, defaulting to https://gitlab.com.
  • Method — The HTTP method to use; defaults to GET for this operation.

Output shape

a single JSON object representing the specified branch's details from the GitLab repository.

This operation calls the GET method on /api/v4/projects/{id}/repository/branches/{branch}, returning branch metadata. Authentication is required unless explicitly skipped. The base URL can be overridden but defaults to https://gitlab.com.

Examples

Example 1: Fetch information for the 'main' branch of a project with ID '1234'.

Set 'Id' to '1234' and 'Branch' to 'main'. Keep default 'Method' as GET.

Links

Discussion