Clean TFS Workspaces with Scorch & Treeclean

If you’ve been working with a TFS workspace for a long time, you know it can get filled up with all kinds of built objects and temporary files. There’s a super-easy way to clean-up using the TFS PowerTools, though.

Check out these two commands:

  • tfpt scorch – Ensure source control and the local disk are identical
  • tfpt treeclean – Delete files and folders not under version control

(Taken from this MSDN forum post.)

7/2/2013 Update:
A co-worker and I were reviewing the scorch command and whether or not pending changes will be deleted through its use. That concern is addressed directly in the help text for the command, accessed by running tfpt scorch /? from the command prompt. Note the last line in the excerpt below, highlighted in red.

Items not in source control will be deleted from disk, just as with the tfpt treeclean command. Items determined to be different on disk from the workspace version will be redownloaded from the server. Items missing on disk will also be redownloaded. Items with pending changes are exempted.

So, it is safe to use scorch while you have pending changes; they will simply be ignored.

Advertisement

Move Shelvesets Between Branches in TFS

At my company, we do a lot of concurrent development between a number of branches. It’s not uncommon for a change made in one branch to be needed in another branch. TFS Power Tools includes functionality to help you quickly and easily migrate a shelveset from one branch into another.

The usage is simple, too. Go to the command-line and type the following (make sure you run it from a directory mapped to a workspace):

tfpt unshelve "My Shelveset" /migrate /source:$/SourceBranch /target:$/TargetBranch

When you run the command, it will load the changes stored in the shelveset into the specified target branch. Super!

%d bloggers like this: