Undoing a checkout that belongs to another user
Since we shipped, we have gotten a lot of questions but there is one that keeps reappearing and I thought to write a short blog post so we can reference it in future discussions.
The question is- How do I undo someone else’s pending changes?
The scenario vary greatly but here are the top ones
· I need to undo a pending change because I need to check-in and someone has it exclusively checked out
· I just need to undo the checkout lock on the file and not the actual change itself
· I need to undo all the changes in a workspace because the person has left the company or the group
Unfortunately, we do not support this from the GUI but you can achieve your goal from the command line. Assuming you are an administrator the command that you have to use is:
tf undo /workspace:OtherUserWorkspace;OtherUser $/Project/ItemName.cs /s:https://yourtfsserver:8080
For the other scenarios I think I will borrow content from one of jmanning blog
(https://blogs.msdn.com/jmanning/archive/2006/01/26/518175.aspx )
1) As an admin, you have the UnlockOther permission to all items in the version control repository. This means that you can undo anyone else's locks on any item. The command-line for that would be something like: tf lock /lock:none $/whatever/item/goes/here/web.config. The lock command is covered @ https://msdn2.microsoft.com/library/47b0c7w9(en-US,VS.80).aspx
2) As admin, you also have the global version control permission AdminWorkspaces - this gives you the simpler and cleaner approach that you can just delete that user's workspace (you don't have to do it from his machine). That will take with it any pending changes, any locks, etc. that the workspace was holding. The command is just: tf workspace /delete hisworkspace;DOMAIN\hisuser - the workspace command is covered at https://msdn2.microsoft.com/library/y901w7se(en-US,VS.80).aspx
Since the user has moved on to another company, team or project, deleting his workspace is likely the better answer. In addition, you do not have to manually undo that checkout lock (or worry about that user potentially having other locks held in that workspace).
-mario
Comments
Anonymous
October 07, 2007
PingBack from http://andrewwhitten.wordpress.com/2007/10/07/deleting-the-workspace-of-a-departed-user/Anonymous
November 07, 2007
Although its a task you seldom would want to do, it might become a necessity when someone leaves theAnonymous
December 26, 2007
The comment has been removedAnonymous
April 10, 2008
A neat little utility called the TFS SideKick was quite handy for us to do the same. And it has a GUI.Anonymous
June 09, 2009
SideKick doesn't help if you can't delete the workspace. In my case, the user is still in the company and still developing. He no longer has a workspace pointing to the project with the locks and there is no copy in his PC. Yet the locks are there and I can't delete them. Even VSS supported this. How did MS miss this on 4 years worth of TFS so far from 2005 to now?Anonymous
June 09, 2009
So, if I may add, I have to use the tf lock to remove the lock including typing a long project file path since the $ path in source explorer cannot be highlighted and copied with Ctrl-C.