TFS: How can you Undo Checkout of Unmodified files

2019-01-15 23:47发布

We use a batch file to generate code, and it automatically checks out the generated files from Team Foundation Server (TFS) so that it can regenerate them. The majority of these files are not modified, but the generator does not know this ahead of time.

The "tfs undo" command undoes the checkout, but prompts if some have been modified (which we don't want to do). We also do not want to check in the generated files right away.

Is there a command (or series of commands) to undo checkout of all unmodified files without prompting the user?

10条回答
老娘就宠你
2楼-- · 2019-01-16 00:36

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.

查看更多
Ridiculous、
3楼-- · 2019-01-16 00:38

Updated this question with an answer when working with TFS2017 and VS2017 only.

The power tools does not exist for TFS 2017 and the old ones can't work well together with it, but apparently most of the functionality has been moved to VS2017 itself or plugins (see below).

Visual Studio 2017 Extension

Some actions like undo unchanged files have moved to an extension for VS2017

"Undo Unchanged" button location:

undo unchanged button location

Windows Shell Integration Extension

Also, you can still set up Windows shell integration through an separate installer which is no longer linked to TFS Power Tools.

The windows shell integration do not work exactly the same as the powertools before, but the most important actions worked for me.

查看更多
贼婆χ
4楼-- · 2019-01-16 00:39

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

查看更多
再贱就再见
5楼-- · 2019-01-16 00:44

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.

查看更多
登录 后发表回答