List branches for HEAD commit

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch.

groot Preview (required)

Listing branches or pull requests for a commit in the Commits API is currently available for developers to preview. See the blog post for more details. To access the new endpoints during the preview period, you must provide a custom media type in the Accept header:



string The token will be passed in the authorization header.



string commit_sha+ parameter


GET https://api.github.com/repos///commits//branches-where-head
authorization: bearer undefined
accept: application/vnd.github.v3+json
user-agent: octokit.rest

Example Response

Status: 200
    "name": "branch_5",
    "commit": {
      "sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc",
      "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
    "protected": false

See documentation on GitHub developer guides