Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS: How can you Undo Checkout of Unmodified files in a batch file

People also ask

How do I undo a checkout in TFS?

Right-Click In the File List, right-click the files you want to undo and select Source Control > Undo Check Out (for selected files) or Source Control > Project > Undo Check Out All (for all files in the project).

What does checkout mean in TFS?

When you want to edit a file you can open it from Solution Explorer or from Source Control Explorer. When you begin editing a file, it is automatically checked out to you.


Take a look on Undo Unchanged command of the Team Foundation Server Power Tools August 2011

c:\myProject> tfpt uu . /noget /recursive

Thanks Matt Florence for link update.

Thanks Ray Vega for actual syntax.


Install Team Foundation Server Power Tools and run the following from the command line using tfpt.exe at the root of your project's workspace directory:

c:\myProject> tfpt uu . /noget /recursive

Including /noget is highly recommended since it prevents a forced 'get latest' of all your project's files which depending on the total number can take a extremely long time.


Thank you @mike & @ray,

I wish to make it easier.

In VS, at Tools menu, click on "External Tools".

External Tools

Click Add.

Enter title.

Command: tfpt.exe

Arguments: uu . /noget /recursive

Initial Directory: [you can choose from the arrow button].

Undo unchanged in solution

Undo unchanged in project

Two new command are added to Tools menu.

Use them when needed.

Enjoy,

Ofir


  1. Right-click on your project
  2. Select undo checkout, then just click okay, or whatever confirmation is left...
  3. Then, while undoing checkout, for every file that has REAL changes in it, a prompt will ask you to confirm the check out for that file... simply click "No to All"

Visual studio will know if the checked out file has changes or none.

WARNING: This method also removes new files, i.e. files that are not yet checked in to TFS. If you want to keep these files then simply exclude them from the set of files you "undo".