Warm tip: This article is reproduced from stackoverflow.com, please click
azure-devops tfs visual-studio version-control visual-studio-2019

How to force TFS server to take all of my local files?

发布于 2020-03-31 22:52:25

I have a couple of ASP.NET Core based projects being developed using Visual Studio 2019.

I am having issues where my workspace and TFS server on Azure-DevOps are out of sync. My PC contains the most recent code and I want to push everything I have on the server. I don't really care about the status of the TFS server as it is wrong. I just want to force everything to get pushed to ensure my PC and TFS are syncing again.

How can I force the TFS on Azure-DevOps to take all my files? I don't even mind removing the project altogether from Azure-DevOps and push all files as if this is a new project.

Questioner
John
Viewed
96
PatrickLu-MSFT 2020-01-31 17:28

According to your description, sounds like there is something wrong with your source control binding. Or maybe some files outside of Visual Studio do not detect by TFS server. Which cause your workspace and TFS server out of sync.

If you want TFS server detect changes done to files outside of Visual Studio, the simplest way is using local workspace.

Detected adds under Pending Changes in Team Explorer

Now anything else changes files outside Visual Studio, your workspace detects the changes automatically.

It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under `Excluded Changes

If you are using server workspace, this is kind like when you are offline, you cannot work with your local files because they are read-only until you check them out. So highly recommend you switch to local workspace, you just need to make sure you open the files in VS from a path which the same as your TFS local worksapce. Then it will auto sync changes in Visual Studio and show in pending changes.

More detailed information on the pros and cons of local and server workspaces, please refer our official link.


Now in your situation, we suggest you fist back up all of your local codes/files first. Then delete your old workspace, create a new local workspace.

Get latest from your sever, then copy all your back up to your workspace folder. Then let windows file system auto detect the difference between them, replace files download from server with your back up local version.

Now your local workspace should contain the latest version of your code/file, Visual Studio will auto detect the changes and list them in pending changes, if something added in excluded list, manually promote them.

Finally you could just check in/push all pending changes to TFS server. Now everything back to the track again.

Hope this helps.