Ricibald
Ricibald

Reputation: 9959

How to undo changes in tfs coming from unmanaged workspace?

I have a workspace that is lost forever. I have some files checked out from this workspace. I want to unlock them but I can't. I tried to do:

TF UNDO $/MyProject/MyFolder/MyFile.cs /WORKSPACE:LOST;user /s:http://mysite:8080

But I got this message:

The workspace LOST;user is not on this computer. Run get (get all if edits were undone) on the computer hosting that workspace to update it with the change s that have been made on the server.

Does exist any way to undo a file (not every file) checked out by unavailable workspace?

Upvotes: 1

Views: 1427

Answers (2)

Mixopteryx
Mixopteryx

Reputation: 1148

As long as you have the appropiate permissions I would think that the method from this answer by @BubbleSort should work: https://stackoverflow.com/a/17870318/1982894 He used TFS 2012, I have tested it in TFS 2010 and it works there too.

Answer copied for easy reference:

(Note: I have the TFS Power Tools installed so if you don't see the described options you may need to install them. http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f )

If you are accessing the Source Control Explorer as a team project administrator (or at least someone with the "Undo other users' changes" access right) you can do the following in Visual Studio 2012 to clear a lock and checkout.

  1. From the Source Control Explorer find the folder containing the locked file(s).
  2. Right-click and select Find then Find by Status...
  3. The "Find in Source Control" window appears
  4. Click the Find button
  5. A "Find in Source Control" tab should appear showing the file(s) that are checked out
  6. Right click the file you want to unlock
  7. Select Undo... from the context menu
  8. A confirmation dialog appears. Click the Yes button.
  9. The file should disappear from the "Find in Source Control" window.

The file is now unlocked.

Upvotes: 0

DancesWithBamboo
DancesWithBamboo

Reputation: 4156

If the workspace is lost, then I would just delete it. Deleting it undoes any changes that were made in it.

tf workspace /delete WorkspaceName;WorkspaceOwner

Upvotes: 5

Related Questions