如何从 TFS 存储库中删除文件而不删除本地文件 [英] How to delete a file from TFS repository without deleting local file

查看:71
本文介绍了如何从 TFS 存储库中删除文件而不删除本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 TFS 2012 对位于文件夹树(不是 Visual Studio 项目)中的一堆文件进行版本控制.我相信很快有一天我会不小心将一个文件添加到版本控制中,我不想被版本控制(我的运气可能是一堆文件).那时,我希望能够从 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.

到目前为止我还看不到这样做.似乎在 Visual Studio 源代码管理资源管理器中有一个将项目添加到文件夹"按钮,但没有免费的删除项目"按钮.

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. 将本地文件复制到其他地方.
  2. 删除本地文件并签入删除(因此它从存储库中删除)
  3. 将文件复制回原始本地位置.(并尽量记住不要再次添加它.)

这似乎是 tfs:删除存储库服务器上的文件并将它们保留在本地.但我希望我错过了一些更新的东西,因为在其他版本控制系统中显然可以在保留本地复制功能的同时从存储库中删除.

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.

如果有关系,我正在使用服务器工作区,可以切换到本地工作区.我不认为 .tfignore 可以帮助解决这个问题(即它可以阻止我将文件添加到存储库,但不能在出错后删除它?).而且我不是管理员,所以我不能破坏东西.

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.

推荐答案

别无他法.您必须将本地文件复制到其他地方,从 TFS 中删除它,然后再将其复制回来.

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

这篇关于如何从 TFS 存储库中删除文件而不删除本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆