Setting to true
returns only protected branches. When set to false
, only unprotected branches are returned. Omitting this parameter returns all branches.
Results per page (max 100)
Default:30
Page number of the results to fetch.
Default:1
Setting to true
returns only protected branches. When set to false
, only unprotected branches are returned. Omitting this parameter returns all branches.
Results per page (max 100)
Default:30
Page number of the results to fetch.
Default:1
Response
Short Branch
Branch Protection
The name of the branch.
Response
Branch With Protection
Commit
Branch Protection
Example:"mas*"
Example:1
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.
The name of the branch.
Response
Branch Protection
Protected Branch Required Status Check
Protected Branch Admin Enforced
Protected Branch Pull Request Review
Branch Restriction Policy
Example:"branch/with/protection"
Example:"https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection"
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.
Protecting a branch requires admin or owner permissions to the repository.
Note: Passing new arrays of users
and teams
replaces their previous values.
Note: The list of users, apps, and teams in total is limited to 100 items.
The name of the branch.
Require status checks to pass before merging. Set to null
to disable.
Enforce all configured restrictions for administrators. Set to true
to enforce required status checks for repository administrators. Set to null
to disable.
Require at least one approving review on a pull request, before merging. Set to null
to disable.
Restrict who can push to the protected branch. User, app, and team restrictions
are only available for organization-owned repositories. Set to null
to disable.
Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to true
to enforce a linear commit history. Set to false
to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: false
. For more information, see “Requiring a linear commit history” in the GitHub Help documentation.
Permits force pushes to the protected branch by anyone with write access to the repository. Set to true
to allow force pushes. Set to false
or null
to block force pushes. Default: false
. For more information, see “Enabling force pushes to a protected branch” in the GitHub Help documentation."
Allows deletion of the protected branch by anyone with write access to the repository. Set to false
to prevent deletion of the protected branch. Default: false
. For more information, see “Enabling force pushes to a protected branch” in the GitHub Help documentation.
Requires all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule. Set to false
to disable. Default: false
.
The list of status checks to require in order to merge into this branch.
Response
Branch protections protect branches
Status Check Policy
Branch Restriction Policy
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.
The name of the branch.
Response