How to unlock a file from someone else in Team Foundation Server
I was able to undo another user's checkout with the following command:
tf undo {file path} /workspace:{workspace};{username}
You'll need to wrap that semicolon in double-quotes if you're running the command from PowerShell. We're running TFS 2010 (and VS 2010).
Disclaimer: I got this from the FCI-H blog at http://fci-h.blogspot.com/2011/01/how-to-force-undo-checkout-tfs.html
Here's what I do in Visual Studio 2012
(Note: I have the TFS Power Tools installed so if you don't see the described options you may need to install them. http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f )
If you are accessing the Source Control Explorer as a team project administrator (or at least someone with the "Undo other users' changes" access right) you can do the following in Visual Studio 2012 to clear a lock and checkout.
- From the Source Control Explorer find the folder containing the locked file(s).
- Right-click and select Find then Find by Status...
- The "Find in Source Control" window appears
- Click the Find button
- A "Find in Source Control" tab should appear showing the file(s) that are checked out
- Right click the file you want to unlock
- Select Undo... from the context menu
- A confirmation dialog appears. Click the Yes button.
- The file should disappear from the "Find in Source Control" window.
The file is now unlocked.
You can use the Status Sidekick of TFS Sidekicks tool and unlock the files which are checked out by other users. To do this you should be a part of Administrator group of that particular Team Project (or) your group should have the permissions to undo and unlock the other user changes which by default Administrator group has.
You can get the tool here: http://www.attrice.info/cm/tfs/