There is a command utility (tf) available to unlock/undo changes done within different workspace.
tf status $/MyProject/MyPath/MyFile.cs /server:my_server /format:detailed
You’ll get something like:-
$/MyProject/MyPath/MyFile.cs;C20290
User : MY_DOMAIN\my_user
Date : Thursday, October 12, 2005 11:25:00 PM
Lock : checkout
Change : edit
Workspace : WorkSpaceName
Local item : [WorkSpaceName] D:\projects\MyProject\MyPath\MyFile.cs
File type : Windows-1252
User : MY_DOMAIN\my_user
Date : Thursday, October 12, 2005 11:25:00 PM
Lock : checkout
Change : edit
Workspace : WorkSpaceName
Local item : [WorkSpaceName] D:\projects\MyProject\MyPath\MyFile.cs
File type : Windows-1252
There is an unlock command – if this works it will be cool as it would mean that the developer wouldn’t loose their changes. I heard that this didn’t work properly for Beta 2 – should be fixed now, the syntax is below:-
tf lock $/MyProject/MyPath/MyFile.cs /lock:none /workspacename:WorkSpaceName /server:my_server
There is also an Undo command. It would get rid of any pending changes that the developer had made and they will lose any work they were doing. The syntax for Undo is:-
tf undo /workspacename:WorkSpaceName;dev_username /server:my_server $/MyProject/MyPath/MyFile.cs
We had a developer leave our company with some files still checked out when we were running on Beta 2. To find out which workspaces the developer had we used:-
tf workspaces /owner:dev_username /computer:* /server:my_server
Then we deleted them. Deleting the workspace also removes the lock on the files. The command to delete a workspace is:-
tf workspace /delete /server:your_tf_server workspacename;workspaceowner
I read somewhere that an graphical admin tool will be available as a download post release for Team Foundation Server. If not, I think I’ve found myself a new project..
Don’t forget to run this commands under the folder that is bound to the TFS – this will ensure correct credentials will be used.