Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a file from TFS repository without deleting local file

Tags:

tfs

I'm using TFS 2012 to version control a bunch of files sitting in a folder tree (not a Visual Studio project). I'm sure one day soon I will accidentally add a file to version control that I don't want to be version controlled (with my luck probably a bunch of files). At that point, I would like to be able to remove the file from TFS, without deleting my local file.

So far I can't see anyway to do this. Seems like in Visual Studio Source Control Explorer there is an "Add Items to Folder" button but no complimentary "Remove Item" button.

The only workaround I can think of would be:

  1. Copy the local file to somewhere else.
  2. Delete the local file and check in the deletion (so it is deleted from repository)
  3. Copy the file back to the original local location. (And try to remember not to add it ever again.)

That seems to be the workaround mentioned in tfs: delete files on the repository server and leave them locally. But I'm hoping I'm missing something newer, since a remove from repository while maintaining local copy feature is apparently available in other version control systems.

I'm using a server workspace if that matters, could switch to local workspace. I don't think .tfignore can help with this (i.e. it could prevent me from adding a file to repository, but can't remove it after a mistake?). And I'm not an admin, so I can't DESTROY things.

like image 641
Quentin Avatar asked Mar 17 '16 14:03

Quentin


1 Answers

No other ways. You have to copy the local file to somewhere else, delete it from TFS, and copy it back.

like image 68
Cece Dong - MSFT Avatar answered Sep 28 '22 02:09

Cece Dong - MSFT