When you perform a check in, Team Foundation Server will not accept items in your changeset that are unmodified, however the rest of the changeset will succeed. If all files are unmodified, you'll get an error and your changeset will not be committed. So if you're just worried about cluttering your history with changes that didn't actually change the content, then TFS will take care of this for you.
However, it can be obnoxious to have a lot of pending changes that don't actually have edits. If what you want to do is only see what's actually modified for code review or just general sanity purposes, the TFS Power Tools contain the tfpt
command, which has an "Undo Unchanged" feature that will undo the check outs on unmodified files.
The undo unchanged command has the following usage:
tfpt uu - Undo unchanged
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.
For example, the following command will do a recursive get on TeamProject
, provide a list of files with redundant changes and then prompt the user if they want to undo them:
tfpt uu C:\TFS\TeamProject /recursive