We have a project that is stored within our TFS server and some files were Checked-Out by me from another computer and another user (both of which are not used anymore). Is there a way to force the unlocking of the file (no changes were made to it so it's safe to do so if I can only do it).
From the Source Control Explorer find the folder containing the locked file(s). Right-click and select Find then Find by Status... A confirmation dialog appears. Click the Yes button.
To unlock a file, click the blue key button to the right of the file name in the list of files. If you are viewing an individual file, the blue key option will appear beneath the file name. Note: Only site owners/administrators and project administrators can lock or unlock files.
File -> Source Control -> Advanced -> Workspaces... In the dialog that came up, I checked "Show remote workspaces" and the locked workspace came up in the window. I then selected it and clicked "Remove".
To unlock a branch from Source Control Explorer, just right click--Advanced--unlock. In addition, you can unlock an item explicitly by using the unlock command or implicitly when you check in. When you check in pending changes to a locked item, Team Foundation removes any locks.
(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.
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/
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With