Monday, October 6, 2008

Undo Pending Changes in TFS

When working with TFS in Visual Studio and it’s time to do the check-in-dance, I usually browse through the pending changes to make sure I haven’t done anything stupid (which is the case more often that I’d like to believe). During that phase, files that are unchanged despite that they’re checked out are really annoying. I’m certainly not the first to blog about this, but I’ve met several fellow programmers that were unaware of the power of the Team Foundation Server Power Tools – Command Line Tool, so I figured I might as well try my best to “spread the word”. At my current project we have a .bat file in the quick launch area that does the following:

cd C:\project\workspace\folder
tfpt.exe uu /noget
pause

After navigating to the workspace root folder, we invoke the tfpt.exe command line, which will notify you of unchanged checked out files and kindly ask you if you’d like to undo the check out. Confirm, then hit the "refresh” button in Visual Studio’s "pending changed” window.