2011-04-07 67 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您有刪除本地文件,並從得到下載到本地工作區的斗篷披風分支選項(基本上將取消特定的分支機構)

相關問題