Reputation: 16499
How do I view all unversioned/uncontrolled files using TFS 2010 and VS 2010?
The problem that I am currently running into is after creating a new controller and view using the context menu (MVC3) I decided to roll back all those files by undoing the add in my pending changes window. I found that the files were no longer in TFS but are still on the disk. I would like to see the files that are currently on the disk but not versioned by TFS.
This is trivial in Subversion and Git (these files will always appear unless told to explicitly ignore them) but I am not seeing an option to view these in TFS - they do not appear under in my Pending Changes view. I am new to TFS so I assume I am just missing something.
Upvotes: 10
Views: 4326
Reputation: 8316
If you are trying to determine all of the files which exist on your filesystem within a project folder that are NOT in TFS,
Open visual studio
Open Team Explorer (ctrl-w, m)
Go into "Source Control"
Navigate to the folder you want to find the unversioned files within.
In the top bar there is an icon with two folders and a magnifying glass between them, hinttexted "compare folders"
Compare "Source Path:" of whatever it suggests (probably server version) against "Target Path:" of your local version.
It will highlight all the differences within those folders. Any files which exist in the right hand (local) column are files which are not currently stored in TFS.
Upvotes: 18
Reputation: 21
Assuming that you have PowerShell installed, and tf.exe (from TFS Explorer tools) and sed.exe (GNU Tool) in your path, you could use this script (PowerShell) to do the work:
if((tf prop .) -ne $null) {
tf folderdiff . /r /view:targetOnly /noprompt | sed -e '/^=\+$/,/^=\+$/d; /^$/d' | %{
if(Test-Path $_) {
rm $_ -Rec
}
}
}
Upvotes: 2
Reputation: 88044
Actually, an pretty easy way to remove files/folders from your file system is to simply delete (or move) the local project folders then do a "get specific version" from TFS. Be sure to check both of the "overwrite" checkboxes.
It will then pull down everything that is currently stored in TFS.
Upvotes: 0
Reputation: 78623
Team Foundation Server does not delete files when you undo the pending add for them - this is to prevent possible data loss. (It's possible, for example, that you want to create a file locally but not check it in to Team Foundation Server - since Visual Studio and Eclipse automatically pend this file as an addition, if it were to remove the files when you undid the add then there would be no way to have a file locally that didn't exist on the server.)
The Team Foundation Server power tools have to different operations that will help you sync up your local workspace with the server.
If you have files on disk that are not on the server and you want to update them (push them to the server), you can use tfpt online
. This will detect all the files that were added or modified locally and create new pending changes to update the server. This is particularly useful if you've been working disconnected from the server and want to pend those changes.
If you have files on disk that you want to remove or otherwise update with the latest server version, you can use tfpt scorch
. This will detect any files that have been added, modified or deleted locally and allow you to update them with the latest server version. If you just want to see the list of files and not actually take any action automatically, there is a preview mode you can use with tfpt scorch /preview
.
Upvotes: 7