Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do you do if the file in TFS is locked by someone else?

Someone left the organisation but before leaving, he locked all the files for an unknown reason.

How do you unlock them all so that the other developers can work?

like image 481
Maxime Rouiller Avatar asked Nov 06 '08 14:11

Maxime Rouiller


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


2 Answers

For the following operation, you will need to be either a project administrator for the project you want to undo the check-in on or a Team Foundation Administrator if you want to do this across all projects.

If you still have the username of the person, you can simply do something like this:

  • Open up Visual Studio command prompt (Start -> Programs -> Microsoft Visual Studio 200X -> Visual Studio Tools -> Visual Studio 200X Command Prompt)
  • Run the following command:

tf lock /lock:none /workspace:WorkspaceName;USERNAME /recursive $/

To get the list of workspaces for a user, just run the following command from the same prompt:

tf workspaces /owner:username

For more commands, check tf /?

like image 81
Maxime Rouiller Avatar answered Sep 24 '22 04:09

Maxime Rouiller


If the developer has left the organization, then the best thing to do is to delete their workspaces. This will unlock the files for you but also free up some resources on the server.

See the following blog post I did on the topic when it happened to me a few years ago.

http://www.woodwardweb.com/vsts/unlocking_files.html

You can either delete the workspace using the command line (tf.exe) or you can use the excellent TFS Sidekicks from Attrice.

like image 34
Martin Woodward Avatar answered Sep 23 '22 04:09

Martin Woodward