A common query we get is how we can undo a checkout for another user, either because the user has left the company, lost their machine and workspace or has simply gone on a vacation. In the following snapshot we can see that MTUNET/willyp has checked out the AssemblyInfo.cs file ... has gone on holiday and is therefore creating a bit of tension in the force. Microsoft reports the common scenarios as:
- Undo a pending change because I need to check-in and someone has it exclusively checked out
- Undo the checkout lock on the file and not the actual change itself
- Undo all the changes in a workspace because the person has left the company or the group
- To list the workspaces for the doomed user, execute the following command:
tf workspaces /owner:MTUNET/willyp /computer:*
... which gives us the following:
- To undo the checkouts on the AssemblyInfo.cs file you can run:
tf undo /workspace:NEPTUNE_TEST;MTUNET/willyp "$/ATC_EcoSystem/ATF/ATF 1.1b 2003/Source Code/Automated Test Framework/Copy of ATFCoreAgent/AssemblyInfo.cs"
... which results in:
- Alternatively if the resource is gone for definite, you can delete the workspaces which will also undo any pending changes using the following command:
- tf workspace /delete NEPTUNE_TEST;MTUNET/willyp /s:http://TFSTEST:8080
and
tf workspace /delete NEPTUNE;MTUNET/willyp /s:http://TFSTEST:8080
If we look at the TFVC repository, we get the following updated view: