如何通过 GUI 撤消 TFS 中其他用户的签出?

作为常驻 TFS 管理员,有时候我会被要求撤销用户对某个文件的签出(通常是锁)。这可以通过使用 TF.exe 实用程序的 Undo 命令(参见 http://msdn.microsoft.com/en-us/library/c72skhw4.aspx)通过命令行来完成,但这有点麻烦。

有没有办法通过 GUI 撤销其他用户的签出?

88446 次浏览

Out of the box, no, but there are at least a couple of options via add-ons.

TFS Power Tools

Once installed:

  1. Open Source Control Explorer
  2. Right-click the item on which checkout is to be undone (or a parent folder of multiple files to be undone)
  3. Select Find in Source Control and then Status
  4. In the Find in Source Control dialog, leave the Status checkbox marked
  5. Optionally, enter a value for the Wildcard textbox
  6. Optionally, enter a username in the "Display files checked out to:" textbox and select that radio button
  7. Click Find
  8. This will result in a list of files
  9. Select the items to undo
  10. Right-click and select Undo
  11. Click Yes when prompted with "Undo all selected changes?"

Team Foundation Sidekicks

Another option is to use the Team Foundation Sidekicks application, which can be obtained here: http://www.attrice.info/cm/tfs/

It has a Status sidekick that allows you to query for checked out work items. Once a work item is selected, there are "Undo pending change" and "Undo lock" buttons that can be used.

Rights

Keep in mind that 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

I just had this problem myself and found an easier way to clean up old workspaces.

1) In visual studio, open source control explorer.

2) From the 'Workspace' dropdown select 'Workspaces...'

3) A dialog will appear showing the workspaces on your current PC. Select 'Show remote workspaces'

4) You will now also see workspaces from your previous PC (as long as they are from the same user account). Select the old workspace(s) and click 'Remove'. This should delete the old workspace from from TFS along with any persisting checkouts.

I'm sure Arne has found a solution but I hope this helps others who google the issue.

if you use the tfs power tools undo procedure above you need to do a get or get latest to update your screen. Otherwise it looks like undo has not worked. The operation completed successfully. Because the workspace Workspace;domain\userID is not on this computer, you must perform a separate get operation in that workspace to update it with the changes that have been made on the server.

Command line

tf undo /workspace: OtherUserWorkspace;OtherUser $/TeamProject/MyFile.cs /s:http://YourTFSServer:8080

https://msdn.microsoft.com/en-us/library/cc470668.aspx