There are a couple of points regarding the uu option for tfpt (recommended in most of the other answers) that were not clear to me at first. Firstly, this is the command line help that can be accessed with the command tfpt uu /?
Undoes redundant pending changes. If the state of an item with a
pending change is the same as on the server, then the change is
undone.
Usage: tfpt uu [/changeset:changesetnum] [/recursive] [/noget]
[filespec...]
- /changeset Compare the workspace to item states at the changeset version specified instead of the latest version
- filespec... Only check the listed filespecs for redundant changes
- /recursive Check the specified filespecs with full recursion
- /noget Do not run get before checking
The /changeset option may not be used with filespecs or /recursive.
Now let me break down the command that is recommended in the other answers.
tfpt uu . /noget /recursive
tfpt uu
specifies that we wish to use the 'Undo Unchanged' command.
.
indicates (I guess) that the current working directory should be used as the filespec.
/noget
ensures that 'get latest version' is not called before undoing the unchanged files.
/recursive
ensures that not just the filespec will be considered but all recursive child folders and files. This seems to be dependent on the filespec - if there is none provided then the whole workspace is processed.
So there are a couple of things to note here regarding the command from above...
- It is dependent on the working directory.
- It does not process the entire workspace.
I have found that the following command works best for me - it will process the entire workspace.
tfpt uu /noget
Note that it is still dependent on the working directory in that tfpt uses it to determine which workspace should be processed. But as long as you provide a path to a file or folder within the workspace, you are good to go.
ADD
changes without prompting (see Ray's answer). – Anthropomorphosis