TF Destroy! Deleting code from TFS

Setting up a application life cycle in Team Foundation Server isn’t without it’s drawbacks.  Sometimes the whole process is trial and error to find a plan that works for your team.  Even if you get that all figured out chances are that along the way you created branches you don’t need anymore, or you branched the wrong code set, or gave it the wrong name.  It can be one big source safe mess after awhile.  All you want to do is clean it up, but it seems getting rid of code is about as simple a bug fixing.

As it turns out there’s a command line option to DESTROY branches in Team Foundation Server.

I know, DESTROY, sounds ominous.  Like the robot from the Lost in Space movie.  “Destroy Jupiter 2! Destroy Robinson Family!  DESTROY! DESTROY! DESTROY!”

Still…we want it gone, right?

TF Destroy will allow you to remove the unwanted branch from TFS without having to Get Latest on the entire code set, check it in, delete it, and update.  With smaller code sets that’s not a problem, but if you have a lot of branches, or large branches, this process is cumbersome.

Step 1. Open a Visual Studio command prompt

Step 2. Navigate to the location of the code set (this might be optional.  skip it for now, but if you’re having trouble come back to this step)

Step 3. Enter the “tf Destroy” command

If your branch is in the root it’s as simple as: tf destroy $”<branch name>”

If your branch is below the root simply add the folder structure: tf destroy $”root/subfolder/MyBranch”

Possible errors:

If you run into any authentication errors check to make sure you are still connected to the Team Foundation Server in Visual Studio.

 

Other Resources:

Here’s a link to MSDN that includes the other TF commands that are available – TF LIBRARY

2 comments for “TF Destroy! Deleting code from TFS

Leave a Reply

Your email address will not be published. Required fields are marked *