Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo another user’s checkout in TFS?

Tags:

tfs

As the resident TFS admin, on occasion I am asked to undo a checkout (usually a lock) that a user has on a certain file checked into source control.

How do you undo another user's checkout?

like image 928
brett rogers Avatar asked Nov 06 '09 21:11

brett rogers


People also ask

How do I undo a checkout in TFS?

Right-Click In the File List, right-click the files you want to undo and select Source Control > Undo Check Out (for selected files) or Source Control > Project > Undo Check Out All (for all files in the project).

How do I undo checkout in Visual Studio?

File, Source Control, Check Out. File, Check Out. Shortcut Menu, Check Out. Undo Checkout: File, Source Control, Undo Checkout.


1 Answers

There are at least 2 different ways to do this:

Command Line

There is a command-line utility called Tf.exe that comes with Team Explorer. Find the documentation here. It can be accessed by launching a Visual Studio Command Prompt window. The syntax of the command is:

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

For one file

tf undo /workspace:workspacename;workspaceowner $/projectname/filename.cs 

GUI

The second is via the GUI, but does not come standard - you have to install the TFS Power Tools. See here for details on how to use this method.

Keep in mind that with either method you will need the appropriate rights. The permissions are called "Undo other users' changes" and "Unlock other users' changes". These permissions can be viewed by:

  1. Right-clicking the desired project, folder, or file in Source Control Explorer
  2. Select Properties
  3. Select the Security tab
  4. Select the appropriate user or group in the Users and Groups section at the top
  5. View the "Permissions for [user/group]:" section at the bottom

Deleting the workspace

tf workspace /delete WorkspaceName;User              /server:http://server:8080/tfs/MyTeamCollection  
like image 81
brett rogers Avatar answered Sep 18 '22 16:09

brett rogers