visual-studiotfsversion-controlazure-devopssource-control-explorer

Moving all items up one level in Visual Studio Team Services (TFS Source control)


When initially adding a project to Visual Studio Team Services (TFS source control) I accidentally did the following:

My Local code structure is as follows:
C:\Projects\MyProject
src
test
projectDocumentation
projectReadme.txt
MyProject.sln

This is the structure I wanted on VSTS TFS when doing my initial commit. So after the commit I expected it to look like the following on the VSTS TFS end, but it did not because of a mistake I made:
BuildProcessTemplates
src
test
projectDocumentation
projectReadme.txt
MyProject.sln

The mistake I made was mapping my local directory to $/MyProject/MyProject rather than just $/MyProject as a result it looks like this on VSTS TFS which is incorrect:
BuildProcessTemplates
MyProject
then within a MyProject folder is all of my outer level project files.

What would be the recommend way to fix this without clearing everything out of source control and starting over? The first thing I did was change the workspace mapping on my local machine to be: $/MyProject <--> C:\Projects\MyProject rather than $/MyProject/MyProject <--> C:\Projects\MyProject, but this is not changing anything on the VSTS TFS side of things.


Solution

  • You can’t do it on VSTS server side directly, the simple way is that:

    1. Open Team explorer of Visual Studio
    2. Click Source Control Explorer to open source control explorer window
    3. Choose corresponding workspace
    4. Create new folder (MyProject)
    5. Right click folder/file > Move > Select target path
    6. Check in pending changes