TFS undo checkout of unedited files
Warning: Please consider that this post is over 10 years old and the content may no longer be relevant.
It bugs me when developers check in files to TFS that haven’t been modified. It’s easy to do, you open a file, edit it, change your mind and ctrl-z it. Now you have a checked out file with no changes and when you do your next check in you’ll probably check that file in too, unless you’re really on the ball and compare each file manually first. TFS makes no distinction between checked in files that were modified and those that weren’t, which makes the job of reviewing code that much harder.
Now I’ve found the resolution and it’s so easy it’s stupid, just undo your changes. That’s right, go on, right click your solution and select Undo Pending Changes
You’ll see see the Undo Pending Changes dialog, make sure you only select edited files (e.g. uncheck add / delete actions), then go ahead and click Undo Changes.
Now the catch is TFS will go ahead and undo the checkout for any unmodified files, when it hits a modified file it’ll prompt you with Confirm Undo Checkout, select No to All.
TFS will continue to undo all unmodified files but leave your modified files alone, now you’re left with only your modified files checked out. Hooraah.