Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tfs: how to unlock changes

Tags:

tfs

unlock

I originally edited a file, which did a checkout. I received a new computer, and now I want to edit the file. I don't care about the original edit.

TFS reports that another user has an exclusive lock on the file. It's not actually another user, it's me, but the machine is different, so the workspace is different.

I tried unlocking with the tf commandline using the following command:

tf lock /lock:none /workspace:oldmachinename;domain\me /recursive $/projectname/directory /s:http:tfs:8080/tfs/project

I get no errors, but when I go into Visual studio 2010 (We're using tfs 2010 as well) The files remain locked.

What am I doing wrong?

like image 855
Jeremy Avatar asked Apr 12 '11 17:04

Jeremy


People also ask

How do I unlock a locked file in TFS?

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 a file for editing on a team?

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.

How do I unlock Visual Studio files?

In Source Control Explorer, open the shortcut menu for the folder or file from which you want to remove a lock, and then choose Unlock.

How many types of locks are provided by TF VC?

Team Foundation provides two types of locks: checkin and checkout. A check-in lock is less restrictive than a check-out lock. When you apply a check-in lock, users can continue to make local changes to the item in other workspaces.


3 Answers

Have you tried using TFS powertools?

Once you have that, you can right-click on your folder or file, and choose Find in Source Control -> Status. After you click Find, it should show you all the check-outs, or files that are checked-out

You should then be able to right-click on the checkout and choose "Undo..".

While this is generally issuing the same command line arguments, I've had good luck with it.

like image 53
AaronS Avatar answered Sep 30 '22 02:09

AaronS


Deleting the old workspace is probably what you want to do. You can do this with the tf workspace command, but an easier method is to use the free TFS Sidekicks add-on which gives you a GUI to manage and delete workspaces.

like image 20
Dylan Smith Avatar answered Sep 30 '22 02:09

Dylan Smith


If you aren't intending to use the old workspace again, it would be a good idea to (carefully) delete the entire workspace. This will clean up everything relating to it, and mean that it no longer "pollutes" listings of your active workspaces, etc.

You can also break the lock on a single file, but you will need to have appropriate permissions to be able to break locks. See here for a specific explanation of how to do it.

like image 44
Jason Williams Avatar answered Sep 30 '22 01:09

Jason Williams