Safely delete a TFS branch project

断了今生、忘了曾经 提交于 2019-11-30 10:54:05

In TFS you generally cannot permanently delete anything inside a team project (and TfsDeleteProject deletes a complete team project, but it is not clear if the source control content will actually be removed as a team project is just the top level of the source control tree).

A delete of a file, or whole set of files is just another tracked change, go back into history and it can still be seen.

You could use permissions to make it inaccessible to all. Or rename under an "Obsolete" team project.

EDIT (I finally remembered where this command was):

There is another option, from the command line: tf destroy:

Destroys, or permanently deletes, version-controlled files from Team Foundation version control.

I would expect this to remove the branch records to create the, now destroyed, files... but you might need to check.

Let me put the facts like this:

  • Within the context of the TFS source control system, "Delete" is a purely logical operation. You can Undelete at any time. You can have multiple deleted items occupy the same path over time, or even simultaneously. Branch relationships are preserved.
  • TFS "Destroy" is physical removal. To maintain database integrity, that means all entity relationships are removed too: changeset history, pending change records, shelved versions, merge history, and yes -- branch hierarchy. This Destroy feature was introduced in TFS 2008.
  • Destroy is the only operation allowed to alter the merge history table (from which branch relationships are determined). All other operations are strictly append-only.
  • TfsDeleteProject does its best to completely remove all traces of a project, the primary goal being to allow creation of a brand new project with the same name. Some TFS subsystems support physical deletes; some, such as WIT field metadata, only support logical deletes, even in TFS 2008 & beyond. In the case of source control, TfsDeleteProject invokes "delete" in 2005 and "destroy" in 2008+.
Radhika

Select the branch folder you want to unbranch. then File > Source Control > Branching and Merging > Convert to Folder.

In VS2013 I couldn't find it under @Radhika answer

I did find it under Team Explorer > Source Control Explorer >right mouse on project > Branching and Merging > Convert to folder

Hope this saves you time.

Edit Copied from comment by @DdW: you need to do a Get Latest Version after converting, before the Delete option will be enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!