Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unlock a file from someone else in Team Foundation Server

Tags:

tfs

filelock

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).

like image 305
David Brunelle Avatar asked Aug 10 '10 17:08

David Brunelle


People also ask

How do I unlock a TFS file locked by another user?

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.

How do you unlock documents in teams?

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.

How do I remove a TFS lock?

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".

How do I unlock a branch in TFS?

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.


3 Answers

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.

  1. From the Source Control Explorer find the folder containing the locked file(s).
  2. Right-click and select Find then Find by Status...
  3. The "Find in Source Control" window appears
  4. Click the Find button
  5. A "Find in Source Control" tab should appear showing the file(s) that are checked out
  6. Right click the file you want to unlock
  7. Select Undo... from the context menu
  8. A confirmation dialog appears. Click the Yes button.
  9. The file should disappear from the "Find in Source Control" window.

The file is now unlocked.

like image 106
BubbleSort Avatar answered Oct 10 '22 11:10

BubbleSort


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/

like image 25
Jehan33 Avatar answered Oct 10 '22 11:10

Jehan33


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

like image 33
Kent Hu Avatar answered Oct 10 '22 11:10

Kent Hu