In the last 6 months or so at work I have picked up the dubious honour of being the friendly TFS administrator. In that time we’ve migrated from one server to another (in different domains), and we’ve had a couple of people leave. This has meant there are often situations where an account that nobody can log in as anymore has some files locked, preventing a check-in or merge, or other such operation.
Normally, I would use the “tf undo” command at the Visual Studio Command Prompt to sort this out, but yesterday I ran into an odd situation where I could not see the pending changes via the tf command, even though I could see them in Visual Studio. Anyhow, I accidentally found a menu item that lets me find pending changes on any part of the source tree, and gives me the opportunity to undo other users’ checkouts on the server.
Fire up Source Control Explorer, and select an item in the main pane. Right-click it and you’ll find the “Find in Source Control” item. This has to sub-items but they take you to the same dialog, with a different set of options ticked.
After clicking “Find” you’ll be presented with the results of a source control query (much like searching through TFS, or comparing). You’ll notice up the top there’s a convenient “Undo” button.
This will make it a lot easier to undo orphaned changes for people.