2011-04-07 130 views
19

我们的编译人员在编译一些源代码时遇到了问题,这些源代码被签入到我们的TFS实例中。如何清除我本地版本的TFS服务器知识?

我正在处理一些我没有准备好检入的更改,所以我对本地文件夹进行了手动备份并删除了本地文件夹的内容。然后,我做了一个“获取最新 - 特定版本,覆盖”以确保我获得了最新版本。并确保它编译(它确实,这个问题是在构建机上的安装问题)。

所以现在如果我手动重命名文件夹在本地回到我的版本我有问题,TFS认为我有所有最新的来源......我不这样做。其他开发者更改了文件,但由于我做了“获取最新 - 特定版本,覆盖”,它认为我的代码完全是最新的。

问题:

  • 可一些如何 '告诉' TFS我的本地版本是不是最新的? (我想我可能会用TFS cmd line util做到这一点,但并不确定哪一个可以)

  • 有没有另外一种方法我应该这样做?

谢谢。

回答

17

您可以删除/删除您的本地工作区。

源控制资源管理器 - >工作区下拉 - >工作区 - >移除

+1

要小心这样做,我泥TFS – Andy 2015-02-17 15:21:05

+0

在删除现有的工作空间后,配置一个新的工作空间来配置本地路径。这对我很有用。 – Harun 2017-09-08 13:49:02

3

在未来,而不是使一个手动复制,创建一个搁置。在“等待更改”窗口中,单击“搁置”并按照对话框(在这种情况下,您将而不是想要保留您在本地的未决更改)。这将您的工作放在服务器上的一个安全的可恢复的位置,但是没有检入它。

或者,在工作空间下拉菜单中,可以创建第二个工作空间。这样可以在本地为您提供两个单独的代码副本,但也有两组单独的结帐。如果你经常发现自己中断了一件工作来看别的东西,这非常有用。

如果你通过覆盖做另一个“具体”,这应该仍然可以解决你的问题。

+0

创建第二个工作区的选项正是我所需要的。谢谢! – 2012-08-16 22:24:08

0

你知道哪些文件发生了变化吗?我们在谈论很多文件吗?或者只有几个?

如果只是几个,那么你应该只是复制你的改变后的版本,然后重新签出文件。然后TFS将注册比你更改这些文件。

如果你有很多改变的文件,那么我建议你给0123.(tfpt)在线“命令行”命令试试。

命令行帮助可以看到here

这里距离Buck霍奇斯一些更多的信息:

Online 

With Team Foundation, a server connection is necessary to check files in or out, to delete files, to rename files, etc. The TFPT online tool makes it easier to work without a server connection for a period of time by providing functionality that informs the server about changes made in the local workspace. 

Non-checked-out files in the local workspace are by default read-only. The user is expected to check out the file with the tf checkout command before editing the file. When working in this 

When working offline with the intent to sync up later by using the TFPT online tool, users must adhere to a strict workflow: 

    * Users without a server connection manually remove the read-only flag from files they want to edit. Non-checked-out files in the local workspace are by default read-only, and when a server connection is available the user must check out the file with the tf checkout command before editing the file. When working offline, the DOS command “attrib –r” should be used. 
    * Users without a server connection add and delete files they want to add and delete. If not checked out, files selected for deletion will be read-only and must be marked as writable with “attrib –r” before deleting. Files which are added are new and will not be read-only. 
    * Users must not rename files while offline, as the TFPT online tool cannot distinguish a rename from a deletion at the old name paired with an add at the new name. 
    * When connectivity is re-acquired, users run the TFPT online tool, which scans the directory structure and detects which files have been added, edited, and deleted. The TFPT online tool pends changes on these files to inform the server what has happened. 

To invoke the TFPT online tool, execute 

tfpt online 

at the command line. The online tool will begin to scan your workspace for writable files and will determine what changes should be pended on the server. 

By default, the TFPT online tool does not detect deleted files in your local workspace, because to detect deleted files the tool must transfer significantly more data from the server. To enable the detection of deleted files, pass the /deletes command line option. 

When the online tool has determined what changes to pend, the Online window is displayed. 

Individual changes may be deselected here if they are not desired. When the Pend Changes button is pressed, the changes are actually pended in the workspace. 

Important Note: If a file is edited while offline (by marking the file writable and editing it), and the TFPT online tool pends an edit change on it, a subsequent undo will result in the changes to the file being lost. It is therefore not a good idea to try pending a set of changes to go online, decide to discard them (by doing an undo), and then try again, as the changes will be lost in the undo. Instead, make liberal use of the /preview command line option (see below), and pend changes only once. 

Preview Mode 

The Online window displayed above is a graphical preview of the changes that will be pended to bring the workspace online, but a command-line version of this functionality is also available. By passing the /preview and /noprompt options on the command line, a textual representation of the changes that the TFPT online tool thinks should be pended can be displayed. 

tfpt online /noprompt /preview 

Inclusions 

The TFPT online tool by default operates on every file in the workspace. Its focus can be more directed (and its speed improved) by including only certain files and folders in the set of items to inspect for changes. Filespecs (such as *.c, or folder/subfolder) may be passed on the command line to limit the scope of the operation, as in the following example: 

tfpt online *.c folder\subfolder 

This command instructs the online tool to process all files with the .c extension in the current folder, as well as all files in the folder\subfolder folder. No recursion is specified. With the /r (or /recursive) option, all files matching *.c in the current folder and below, as well as all files in the folder\subfolder folder and below will be checked. To process only the current folder and below, use 

tfpt online . /r 

Exclusions 

Many build systems create log files and/or object files in the same directory as source code which is checked in. It may become necessary to filter out these files to prevent changes from being pended on them. This can be achieved through the /exclude:filespec1,filespec2,… option. 

With the /exclude option, certain filemasks may be filtered out, and any directory name specified will not be entered by the TFPT online tool. For example, there may be a need to filter out log files and any files in object directories named “obj”. 

tfpt online /exclude:*.log,obj 

This will skip any file matching *.log, and any file or directory named obj. 
+0

只是对这个小小的评论。如果你只是检查所有的文件,然后再次检查它们。当您签入TFS时,会将文件的散列值与以前的版本进行比较,并且只包含您的更改集中已更改的文件。因此,如果您的计算机上尚未安装TFS Power Tools,则可能是此实例中最简单的恢复方法。 – 2011-04-08 09:12:23

15

如果获得变更为您的源代码“修订1”的具体版本,TFS将删除本地文件,并会认为你不再有工作区中的最新代码。然后,当你做最新的时候,它实际上会得到最新的。

+1

这是我长久以来听过的最酷的技巧之一,也很棒!您可能需要进入并清理TFS中没有的文件(bin文件夹等)。 – 2013-05-08 20:56:56

+0

这对于需要在工作区中有多个分支但大多数时间不需要文件的情况(如合并)很有用。 – NextInLine 2015-01-27 15:34:45

+1

这是一篇文章,描述这个http://stackoverflow.com/questions/19785117/delete-local-folder-in-tfs请注意,你不是在搜索一个名为“Revision 1”的变更集,而是一个名为“1”的变更集 – user2023861 2016-05-17 13:30:52

0

我使用黑客打开解决方案没有网络连接(拔掉电缆,关闭wifi),解决方案将在离线模式下打开。

还有一个叫做“脱机”的插件。

然后,您点击自动显示的“上线”,以备离线解决方案。

之后,VS将检查所有本地文件对TFS和自动签出已更改的文件。

但对于你的情况,我也建议使用shelvesets。

0

在TFS 2013+和2015+ VS您有删除本地文件,并从得到下载到本地工作区的斗篷披风分支选项(基本上将取消特定的分支机构)

相关问题