Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default branch policies in azure devops

Is it possible to set branch policies across all repo's? In other words, When creating a branch, a default branch policy is already set for master.

like image 258
Igor Avatar asked Sep 26 '18 07:09

Igor


3 Answers

It's been changed now. So for others who look for it, you can find it there:

  1. *Project Settings
  2. 'Repositories'
  3. All repositories -> 'Policies' tab
  4. On the bottom there should be 'Branch policies' section with '+' button

Screen from the mentioned view

like image 83
codeedward Avatar answered Oct 09 '22 17:10

codeedward


Right now you can't. You could listen to events in Azure DevOps for project creation for example and then set the policy yourself. For some information how to start see here: https://learn.microsoft.com/en-us/azure/devops/repos/git/create-pr-status-server-with-azure-functions?view=vsts

like image 6
Rob Bos Avatar answered Oct 09 '22 17:10

Rob Bos


Indeed as @Thomas Harris mentioned in the comment above, you can set it for all repos in a single project via

  1. **Project Settings*
  2. Cross-repo policies under "Repos" heading
  3. Click Add branch protection button

And then you can select whether this applies to the default branch or a specific branch name pattern.

Set project-wide branch protection via Project Settiongs

like image 6
julie-ng Avatar answered Oct 09 '22 18:10

julie-ng