One of the rare but critical tasks of Configuration Management is the unlocking of items locked or checked out by someone else, like an ex-employee or a developer in the Bahamas while an emergency patch needs to be pushed out.
Unfortunately, the unlock action is not available in the context-menu or a GUI but needs to be executed from a command line. I wonder why it’s not in the GUI, granted deleted files and pending changes will not necessarily be visible in the GUI but at least the Undo should be available for visible items while the command line still provides the all-encompassing functionality.
The help was not very clear, so I’ll simplify the command for you.
There are 2 possible options for unlocking, viz. unlock or undo (if checked out for Edit).
The respective command to use is tf lock /lock:none or tf undo
The parameters in both cases are the same:
filename (in the help topic, this is the itemspec parameter)
This is the file you want to unlock
/workspace: [user’s workspace];[user name]
The user’s workspace needs to be figured out…by right-clicking the locked item and selecting Properties… and then the Status tab
The user name is the fully qualified user name, in the form: domain/user
/s:[server path]
This is the TFS server in question. Typically it’s http://servername:8080/
So, a sample command would be something like:
tf undo $/Apps/Dev/file1.aspx /workspace:”Dev station”;corp1\ra /s:http://altair:8080
(You run this is on a VS client, at the Visual Studio command prompt)
Another command I found useful during the process was tf status /user:Joe /s:server path, which essentially lists all files locked by Joe. I piped it to a text file (with >> C:\joe.locked.txt) to get a report.
[edit – changed colon to semicolon above. Thanks for the feedback]
February 24, 2009 at 6:36 pm
You show the seperator for user’s workspace and user name as a colon, but its actually a semi-colon. Using a colon throws an error.
tf undo [/workspace:workspacename[;workspaceowner]] [/server:servername]
Other than that, thanks a bunch for the article! Answered my problem perfectly.
September 9, 2010 at 8:44 am
Thanks,
I’ve followed your advices and worked.
Cheers,
Catalin
April 15, 2011 at 8:17 pm
Thanks, it worked!, and yes, you have to use a semicolon instead of a colon in the workspace parameter
July 12, 2011 at 7:35 pm
That was helpful.Thanks!
November 1, 2011 at 6:04 pm
Thanks.
Just to let you know that “tf lock /lock:none” will not work for items that need to be checked out exclusively. You have to use “tf undo” in those cases.
October 8, 2012 at 5:51 am
Thanks a lot! Helped me unlock my own files from a different computer (a different workspace) 🙂
November 4, 2012 at 9:50 am
Hi there, I do think your blog could be having web browser compatibility
issues. Whenever I take a look at your web site in Safari, it looks fine but when opening in IE, it has some overlapping issues.
I merely wanted to give you a quick heads up!
Besides that, excellent site!
January 2, 2013 at 10:31 pm
I have learn a few good stuff here. Definitely value bookmarking for
revisiting. I surprise how so much attempt you place to make any such
magnificent informative web site.
February 5, 2013 at 4:19 pm
We are a group of volunteers and starting
a new scheme in our community. Your website provided us with valuable information to work on.
You have done a formidable job and our entire community will be grateful to you.
March 18, 2013 at 10:50 pm
Hey I know this is off topic but I was wondering if you knew of
any widgets I could add to my blog that automatically tweet my newest twitter updates.
I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
May 3, 2013 at 12:40 am
Its been a long while since I was able to encounter a competent post similar to this.
I am excited on what your upcoming work will be.
A big heads up for such an incredible job.
May 17, 2013 at 1:24 pm
I don’t often leave feedback on any article however this
article captured my attention, I have to put
a remark. I have to proclaim this article is well
written. No unwanted words and is honest
June 1, 2013 at 8:24 am
Good day! I just would like to give an enormous thumbs up for the good data you’ve here on this post.
I will likely be coming again to your weblog for
extra soon.
March 6, 2014 at 7:39 pm
THANK YOU!!! Finally I was able to remove a lock that has been tormenting me for the past 3 months. Thanks for this post. It explains in detail what MSDN doesn’t. Much Kudos!.
November 30, 2014 at 6:17 am
glad to be of help. Good luck to you.
March 12, 2014 at 10:33 pm
hello there and thank you for your info – I have definitely picked up something new from right here.
I did however expertise a few technical issues
using this site, since I experienced to reload the web site lots
of times previous to I could get it to load properly.
I had been wondering if your web hosting is OK? Not that I am complaining, but
slow loading instances times will very frequently affect your placement
in google and can damage your high-quality score if ads and marketing with Adwords.
Well I am adding this RSS to my e-mail and can look out for a lot more
of your respective interesting content. Make sure you update this again soon.
March 14, 2014 at 11:53 pm
Hi to all, as I am in fact eager of reading this blog’s post to be updated daily.
It consists of nice data.
April 24, 2014 at 6:19 pm
Pretty section of content. I just stumbled upon your site and in accession
capital to assert that I acquire in fact enjoyed account your blog posts.
Anyway I’ll be subscribing to your feeds and even I achievement you
access consistently fast.
May 31, 2014 at 9:32 pm
What a data of un-ambiguity and preserveness of precious knowledge
concerning unexpected emotions.
July 16, 2014 at 9:40 pm
whoah this weblog is magnificent i really like studying your
posts. Stay up the good work! You recognize, a lot of
people are hunting round for this information, you can aid
them greatly.
August 3, 2014 at 4:16 am
Wow, that’s what I was looking for, what a data! existing here at this webpage, thanks admin of this
web page.
May 29, 2015 at 7:54 pm
Fantastic! Saved my day.
August 31, 2017 at 10:50 am
Hi there, yes this article is genuinely good and I have learned lot of things from it on the topic of blogging. thanks.|
September 13, 2018 at 11:07 am
check these guys out
Unlocking items (locked by someone else) in TFS Source Control | Techkn0w
May 29, 2019 at 8:26 pm
website
Unlocking items (locked by someone else) in TFS Source Control | Techkn0w
August 19, 2020 at 11:44 pm
velavissesque