Wednesday, February 6, 2008

Undoing Checkout for Another User in TFS 2005

It is not as easy as it should be to undo someone else's checkout in Team Foundation Server 2005.  In 2008, you can do it through a GUI, but only if you have the Power Tools installed.

Here is how to do it in TFS 2005, from the command line:

tf undo [/workspace:workspacename[;workspaceowner]] 
[/server:servername] [/recursive] itemspec [/noprompt]

I was also faced with having to add my login info, so the exact command I used was as follows:

tf undo /workspace:WORKSPACE-NAME;User $/myProject/CheckedOutFile.cs /login:myusername,mypassword

I also found out that you can delete an entire workspace for a developer who is no longer on your project and maybe had some files checked out.  That command is even easier, and will automatically undo any checkouts:

tf workspace /delete Workspace  (add "/login:name,password" to end of command if not using AD)

No comments: