branch protection rule
A setting on a hosting service that stops changes reaching a branch, usually main, unless conditions such as an approved review and passing checks are met.
In more detail
It can block direct pushes, force pushes and deletion, so every change arrives through a reviewed pull request. Hosting services such as GitHub and GitLab provide it; plain Git has no such rules.
Example
In Terraform: For Terraform it is how a team makes sure nobody can change or destroy production alone: applies run only from the protected branch, after approval.Related terms
- required status check — A check, such as a CI job, that must pass on a pull request before branch protection allows it to merge.
- pull request — A request on a hosting service such as GitHub to merge one branch into another, with a page for review, discussion and automated checks.
- environment protection rule — A rule on a deployment environment, such as required reviewers, a wait timer or allowed branches, checked before a job may deploy there.
- status check — A pass or fail result that a pipeline job reports on a commit or pull request, which can be required before merging.
- CODEOWNERS — A file in a repository that maps paths to the people or teams who must review changes to them.
- main branch — The branch a repository treats as its primary line of work, usually named main (older repositories often use master).
- code review — A teammate reading a proposed change before it is merged, to understand it, catch mistakes and share knowledge.
- force push — A push that makes the remote branch match yours even when that throws away commits the remote has.
- release gate — An automatic check that must pass before a change may be deployed.
Taught in
- Branch Policies And Protection Rules — Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep
- Someone Cleaned Up The History: Versioned And Immutable — Certified GitOps Associate (CGOA) Exam Prep
- A Bucket Nobody Wrote Down: State Stores Beyond Git — Certified GitOps Associate (CGOA) Exam Prep
- Scaling with Matrix Builds — Continuous Integration & Continuous Delivery Pipelines
- Shift-Left Security Principles & Automated Pipeline Gates — Cloud Security & DevSecOps Engineering
- Reviewing Code Well — Advanced Git Internals & Distributed Workflows
- Tearing It Down With Destroy — Infrastructure as Code with Terraform
- Running Terraform In CI — Infrastructure as Code with Terraform