开发者

How to undo another user’s checkout in TFS?

开发者 https://www.devze.com 2022-12-10 14:18 出处:网络
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.

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?


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 


The easiest way I found is to use the free TFS Sidekick application. It has an option to view and undo other user's checkout.


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' drop-down 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.


Select your file in TFS sidekick, then above the list, you have a "undo pending Change". Click on that and the change will be undone :) The icon is similar to the "Undo" icon in MS word Get TFS sidekicks from http://www.attrice.info/cm/tfs/index.htm

0

精彩评论

暂无评论...
验证码 换一张
取 消