Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 391
stephenbayer Avatar asked Nov 06 '14 23:11

stephenbayer


People also ask

How do I revert changes in TFS?

Select the changeset you want to roll back. Right click on the changset and choose "Rollback". Check that the pending changes are correct (the rollback command will revert the entire changeset not just the file you selected)

How do I undo all changes in Visual Studio?

If the file is in the Changes section, right-click it and choose Undo Changes to discard all changes to the file since the last commit. Visual Studio supports discarding all uncommitted changes to a file by reverting the file to its version in the last commit.

How do I get rid of pending changes in TFS?

To undo all changes you have made in your solution or a code project, open the context menu, and then choose Undo Pending Change. In the Undo Pending Changes dialog box, make sure the changes you want to undo are selected, and then choose Undo Changes.

How do I recover a deleted file in Visual Studio?

Restore an item deleted from the serverFrom the menu bar choose Tools, Options. On the Options dialog box, navigate to Source Control, Visual Studio Team Foundation Server. Select Show deleted items in the Source Control Explorer, and then choose OK.


2 Answers

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.

like image 150
jdmichal Avatar answered Oct 25 '22 05:10

jdmichal


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.

like image 28
jessehouwing Avatar answered Oct 25 '22 04:10

jessehouwing