Post

Wildcard For Azure Devops Branch Policies

We use GitFlow as our branching model on Azure Devops. When we create a new Release branch, we want it to be protected by default. By protection I mean, preventing unreviewed code changes.

This is not like setting a branch policy for an existing branch, it would be a wildcard for future branches. You need to do one extra step to access the correct page for a wildcard and this is not documented yet.

  1. Go to Branches page under Repos on Azure Devops.
  2. If you already have a folder in your repo, you can skip to step 5.
  3. Click New branch and fil in the name like release/tempBranch.
  4. Click Create.
  5. Click ⋮ (vertical ellipsis) next to a folder.

    Azure Devops Wildcard Branch

  6. Select Branch policies in the menu.
  7. It will redirect to the branch policies page with the title Branch policies for {folderName}/*.
  8. Here you can set the policies.
  9. After setting the policies in place you can remove the tempBranch if you created one.

Azure Devops Wildcard Branch Policies

The existing or future branches which matches the wildcard will be using the policies.

Cover photo by Jan Huber on Unsplash

This post is licensed under CC BY 4.0 by the author.