Branch Protector
  • Updated on 02 May 2019
  • 1 minute to read
  • Contributors
  • Share
  • Dark
    Light

Branch Protector

  • Share
  • Dark
    Light

What is it?

Protect the organization repositories by enforcing branch protection rules on existing and future repositories

Why is it important?

While "Smart Policy" runs on the pull request level to make sure your code is aligned with your organization policy, there are still other best practices which can be applied on the branch level:

  • Protect the default branches from force-pushes or being deleted
  • Prevent direct commits to the default branches
  • Require pull request reviews before merging
  • Dismiss stale pull request approvals when new commits are pushed
  • Enforce Datree's smart policy check to pass

Enabling "branch protector" across your repositories will help you enforce better development workflows for confident and compliant code.

How does it work?

This functionality requires the installation of additional GitHub app - datreeio-actions.

e0d09db-Screen_Shot_2019-03-06_at_15.13.46

After the app was installed on your origination, you can set your Branch Protector preference.

79f8199-Screen_Shot_2019-03-05_at_17.04.55

You can enforce branch policies on existing and/or future repositories

Protect the default branches from force-pushes or being deleted

Block any option to force push commits or delete the master branch by accident or on purpose

Prevent direct commits to the default branches

Verify every code change to the master branch is made via the pull request flow and not directly to the master branch

Require pull request reviews before merging

Ensure every pull requests will be reviewed before collaborators can make changes to a protected branch

Dismiss stale pull request approvals when new commits are pushed

Dismiss a pull request approval when a code-modifying commit is pushed to the branch w/o being reviewed again

Enforce Datree's smart policy check to pass

Ensure every pull requests will apply to Datree's Smart Policy to merge code changes to production

Which integration are supported?

Git vendors: GitHub

Common questions

What will happen if I will change my repository branch settings?
Our app is constantly checking your repository settings, and when they are changed - it will automatically be changed back to your Branch Protector settings.

Was this article helpful?