Setting up branch protection for Git repositories

The usage of protected branches is covered in more detail in a blog post here. Shortly: Setting a branch protected will affect in the following ways:

  1. All force pushes to the branch are rejected
  2. Deletion of the branch is prohibited
  3. Only those with admin or master role may push changes to the branch

To set up a branch as protected, follow these steps as an admin of a project:

  1. Navigate to a project
  2. Navigate to the repositories screen
  3. Navigate to the repository in question
  4. Click the cogwheel icon, which will open the repository settings task view Repository settings icon
  5. Protect or unprotect a branch by clicking the protected or unprotected icon Protected branches
  6. The settings are saved automatically

Note: The master branch is protected by default, but the protection setting can be changed.

Updated on: 12 September 2017