Share via


TFS 2010 : How to apply check-in policies to only certain branches or folders

This question keeps coming up frequently, and so I thought to make a succinct post on how to do this.

 

First install the TFS 2010 Power Tools by downloading it to your Client box. You can do a bing search to locate the “TFS 2010 Power Tools download”. This has to be installed on each Client box on which Visual Studio 2010 is installed.

Then go to Source Control as shown below:

image

Once you installed the Power Tools, you should see a new set of Check-in policies in place as shown below.

SNAGHTML830358b

 

Note that it says that “This policy scopes other policies to specific folders or file types, and there you have it. So what it means is essentially you could create some other policy and use that as a child to this policy and then constrain it to be triggered for checking only if the check-in happens to go under the folder or branch that you specify in its scope.

 

clip_image004

 

To further illustrate this:

Below I have created a “Code Analysis” policy, and then used it as a Child policy for the “Custom Path policy” and scoped it to apply to the “DEV” branch. You can just enter a matching string for regexing into the particular branch you want to.

If this is not what you are seeking, then you might also consider writing a custom check in policy. Note that policies are evaluated at the client prior to checkin.

clip_image002

 

That’s all there is to this.

Comments

  • Anonymous
    February 17, 2012
    How do you know which Custom Path Policy applies which Checkin policies? We have 56 branches and I can't figure out which check-in policies apply to which branch. Ideas?

  • Anonymous
    April 04, 2013
    As a wise man (Dean Varillas @ cartwheels) once said, 56 branches is up to no good, just like Engelwood if you know what I mean.

  • Anonymous
    July 26, 2013
    It would work better with a regex; of .DevProject/DEV.  This is case sensitive.  Also note that the Child policy must have been previously added, and all machines performing a checkin will need the power tools installed.  The policy takes effect immediately, no restart of Visual Studio needed. Be sure to disable the child policy.

    • Anonymous
      June 22, 2016
      Somehow in 2015 version checkin policy is being applied to entire Team project. I have created a work item query policy and I have linked my query to that workitem Query policy. ANd Then i created custom path policy and as a child policy i have given work item query policy from the drop down and path like of the branch like ./Development/Dev1/. Please help
  • Anonymous
    September 04, 2015
    If you use the newest version, it uses RegEx. You have to use ./DevProject/DEV/.

  • Anonymous
    June 22, 2016
    Somehow in 2015 version checkin policy is being applied to entire Team project. I have created a work item query policy and I have linked my query to that workitem Query policy. ANd Then i created custom path policy and as a child policy i have given work item query policy from the drop down and path like of the branch like ./Development/Dev1/. Please help