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
You need to be project admin or to have tfs account (user name/password) of the user who had locked the file.
in Visual Studio 2019:
Drive:\your solution path>
tf vc undo /workspace:"workspacename;worksapceowner" "$/path/[file.extension][*]" [/recursive] [/login:"user name,password"]
tf vc undo /workspace:"DESKTOP-F6BN2GHTKQ8;Johne123" "$/mywebsite/mywebsite/appsettings.json"
If you login into the source control with the admin account, you will be able to force undo checkout, or check in with any file you provide.
I solved this with the TFS powertools (dec 2011 - for VS 2010 TFS 2010)
http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
Find in Source Control | Status... allows you to find all files checked out to a specific person
right click and UNDO... can remove each checkout.
In my case, I tried unlocking the file with tf lock
but was told I couldn't because the stale workspace on an old computer that no longer existed was a local workspace. I then tried deleting the workspace with tf workspace /delete
, but deleting the workspace did not remove the lock (and then I couldn't try to unlock it again because I just got an error saying the workspace no longer existed).
I ended up tf destroy
ing the file and checking it in again, which was pretty silly and had the undesirable effect of removing\ it from previous changesets, but at least got us working again. It wasn't that big a deal in this case since the file had never been changed since being checked in.
2019 answer, as most of the above is depracated.
tf undo /workspace:"hostname;username" "$/path/*" /s:https://yourhostname/tfs
in an elevated command prompt, from a path such as
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>
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/