MikingTheViking
MikingTheViking

Reputation: 936

Azure Branch PR Policy - Require Source Branch Be Up-To-Date

I'm trying to get quality branch policies on my develop branch and so far I've got some good basics:

What I want to ensure is that a source branch in a PR must be up-to-date with its target branch. I cannot seem to find this setting and was wondering if anyone knew if it existed.

GitHub has this as an available PR restriction:

GitHub sample

Upvotes: 3

Views: 1044

Answers (2)

Leo Liu
Leo Liu

Reputation: 76880

Azure Branch PR Policy - Require Source Branch Be Up-To-Date

Indeed, there is no such directly option or description about this feature in Azure devops.

But after we are familiar with the branch policies for azure devops we will find an alternative, that is what 4c74356b41 said, add a Build validation:

Set a policy requiring changes in a pull request to build successfully with the protected branch before the pull request can be completed. Even if you're using continuous integration (CI) on your development branches to catch problems early, build policies reduce build breaks and keep your tests results passing.

When a build validation policy is enabled, a new build is queued when a new pull request is created or when changes are pushed to an existing pull request targeting this branch. The build policy then evaluates the results of the build to determine whether the pull request can be completed.

If a direct option is your ultimate goal, you could add a uservoice here, TFS PM will kindly review your suggestion.

enter image description here

Hope this helps.

Upvotes: 1

4c74356b41
4c74356b41

Reputation: 72171

if you enable a build validation it will have the same behaviour as the one you describe.

Reading: https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops#build-validation

Upvotes: 1

Related Questions