text: Q:
  
  How to restrict merge from specific branches
  
  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.
  
  A:
  
  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
  }
  
  