Azure DevOps prevent push to master but allow PR merge

Viewed 3143

My understanding is that branch policies allow us to prevent push to master but allow PR. But I could not find a policy or security settings on Azure DevOps that allow me to do this. What am I missing?

1 Answers

After you set up a required branch policy, you can't directly push changes to the branch. Changes to the branch are only made through pull requests. You can refer to this Q&A in the document.

Please note that:

  • If you have permissions that allow you to bypass branch policies you can push directly to a branch after a required branch policy is configured.
  • If you configured optional branch policies, but no required branch policies, you can push changes directly to a branch.

For example: If the policy requirement here is optional, you can still push changes directly to the branch. If the policy requirement here is required, you need to create a pull request to push changes.

enter image description here

Related