Reputation: 113
I would like only specific branches merge to specific branches.
Some example: I want to do master
branch accept pull requests only from test
branch, and test
branch accept only from development
branch.
How can I do this restriction on TFS/Git?
We have some policies about reviewers and build validation.
Upvotes: 9
Views: 7443
Reputation: 113
I solved my problem via 3rd party web hook integration.
I developed nodejs expressapp and host it different server and i created integration rule which triggered when the pull request created. And i check source and target branches in my node app.
After that i added this integration to merge policies.
So cool , so easy. Thanks to everyone.
Upvotes: 1
Reputation: 41575
If you have branch policies you can do a workaround to achieve the goal:
In the build definition (that you specified in the build validation) add a PowerShell task that check the source branch of the pull request. When the source branch is not what you want the build will fail.
For example, in the following script, if the source branch is not test
the build will fail, so add it in the master
branch build validation:
$sourceBranch = "$(System.PullRequest.SourceBranch)"
if($sourceBranch -ne "test")
{
exit 1
}
Upvotes: 16