stephenbayer
stephenbayer

Reputation: 12431

Complete nuke all changes in visual studio and reset from TFS

I am using Visual Studio 2013. Regarding TFS workflow, there are issues I have when working on a bug or work item, after I am finished, I move the changes into a shelfset for further review, undo my changes by right clicking on the pending changes and clicking undo. The move on to the next issue or enhancement. The shelfsets can be indpendendly reviewed and then applied to whatever branch they are currently needed.

The problem I have is that undoing through visual studio does not completely reset the solution to a completely clean state. There are often orphaned files around or projects that have references to non-existing files or other such problems. I'd like to be able to completely nuke and reset my solutions from source control as if I am a new developer and I have not found an easy solution to do this.

Currently, the only way I can accomplish this is to go to "Source Control Explorer" remove the file system mapping for the project. Go to the file system, removed the folder. Go back into "Source Control Explorer" add the mappings back in. And then "Get Latest Version".

Is there an easy way to completely reset a solution in Visual Studio with TFS?

Upvotes: 5

Views: 2075

Answers (2)

jdmichal
jdmichal

Reputation: 11162

You can achieve this in Visual Studio 2010 without Power Tools. Process is likely similar for other VS versions.

Open the Source Control Explorer. Right-click the entry you want to reset, then choose "Get Specific Version." Select the version you want to reset to. Ensure that the two checkboxes are checked:

☑ Overwrite writeable files that are not checked out

☑ Overwrite all files even if the local version matches the specified version

This will overwrite all locally mapped files with the server's version. (And will correspondingly take time proportionate to the number of files.) I do not believe that this operation will remove any unmapped files.

Upvotes: 6

jessehouwing
jessehouwing

Reputation: 114927

If you have the Power Tools installed, call tfpt scorch /deletes /recursive /diff. That should make your local folder match the server exactly.

You can also call tfpt treeclean, which will just delete any item that is not mapped to TFS. It won't update or replace any changed files though, like scorch will.

Upvotes: 3

Related Questions