Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Team Foundation Server: how to delete local files which are not in version control?

I am trying to perform a complicated merge between branches of the same solution. We use Team Foundation Server, but I would prefer compare folders locally with WinMerge instead of relying on TFS directly to tell me what changed. The problem is, there are a lot of files that are not in source control which pollute the WinMerge folder comparison: bin, obj, static code analysis files, remaining projects that were created locally but discarded and never deleted...

I could delete local folders and force get from source control to clean it, but I'm connected to the source control through a slow VPN and it could take a while; or I could also manually delete whichever files I think are duplicate, but that is too empirical to be exhaustive.

So here's my question: is there any tfs command to clean local folders?

like image 396
Evren Kuzucuoglu Avatar asked Oct 28 '11 09:10

Evren Kuzucuoglu


People also ask

How do I permanently delete a file in TFS?

Use the tf destroy command to destroy, or permanently delete, version-controlled files from Team Foundation version control. The destroy action cannot be reversed. You must not destroy files that are still needed.

How do I delete a file from source control in TFS?

In either Solution Explorer or Source Control Explorer, browse to the folder or file that you want to delete. Select the items that you want to delete, open their context menu (right-click), and choose Delete.

How do I remove Team Foundation Server version control?

Right-click your project or project suite in the Project Explorer and then click Source Control > Unbind From Team Foundation Server.

Can I delete $TF folder?

To answer the original question, the answer is yes. However, in order for TFS to track changes, it will need to be recreated, albeit with fewer folders and much smaller disk space. To do that: First delete all the tf$ folders currently in your current workspace folder.


3 Answers

In 2015 tfpt has since been deprecated. After downloading the 2015 TFS Power Tools the new command is:

tf reconcile /clean /recursive .

The ending dot assumes your Developer Command Prompt is sitting at the root directory in your workspace you wish to start from, and /recursive assumes you want to include all subdirectories.

When you run the command it will pop up a preview of all changes it will make, and give you the opportunity to cherry-pick which ones you'd like to keep, if not all.

Note: pending files will not be included in the results, which is usually what you want. If you want to remove them as well, you should undo your pending changes first.

like image 58
TTT Avatar answered Oct 13 '22 18:10

TTT


You can use the:

tfpt scorch

..command for this purpose. the TFPT command line is part of the TFS Power Tools

like image 22
Ewald Hofman Avatar answered Oct 13 '22 19:10

Ewald Hofman


For Visual Studio 2017, there is no Power Tools but the good news is that most of the features are moved into TFS 2017. Therefore, you can simply use the following without installing any tools.

tf vc reconcile /clean /recursive .

like image 24
sotn Avatar answered Oct 13 '22 17:10

sotn