PositiveGuy
PositiveGuy

Reputation: 47783

Renaming folders in TFS 2010

What's the proper way (sequence of steps) to rename a folder in TFS? I tried doing it locally then commit but it's not working. I think you prob have to do it from TFS (server-side) instead right? But then if you do that and get latest then I guess it'll just update your folder locally and hopefully you don't have any other conflicts?

Upvotes: 3

Views: 7423

Answers (1)

pantelif
pantelif

Reputation: 8544

Open Source Control Explorer, mark your module, press F2 & enter the new name.
Module will appear in your Pending Changes window with Change type "rename".

Suppose you had a module named test.txt which participated in 3 changesets. It then gets renamed into itsatest.txt When I get History for file itsatest.txt I get this:enter image description here

In my hard drive the test.txt doesn't exist after the rename.
The same principle works with folders as well.

EDIT after comment

Problem is I did all this renaming locally on my file system...I don't want to lose all these changes because I also changed namespaces in code, etc

I see.
One way to proceed is to copy the entire directory somewhere out of your workspace.
Then delete it from your workspace and retake it from source control with 'Get specific version' and 'Overwrite all files even if the local version matches the specified version'.
Proceed with the rename & checkin.

Perform a directory compare between your locally stored dir & the one you 've just renamed. All your changed files should appear.
Check them out & copy-paste them manually into your workspace.

This should take care of the situation.


I'm pretty sure I remember another TFS SO post, where the recommendation was 'never mix pending changes with pending renames' - can't seem to find it ATM...

Upvotes: 5

Related Questions