tfsvisual-studio-2013team-explorer

HOWTO: Fix an out-of-sync TFS workspace after a restore


Due to a ransomware virus, we had to restore a back-up image of the TFS server code repository that we made some days ago.

Fortunately I have an updated copy in my local workspace with the latest changes that were checked in just before the disaster. The snapshot restored does not have this latest changes. So now some files in my local workspace are newer than those in the snapshot restored, I mean my local workspace has some files which contain changes not present in the snapshot restored. Furthermore and despite of some files in my local workspace are different from those in the snapshot, they are not marked as checked-out in Team Explorer.

As the latest changes are in my local workspace (and not in the snapshot because they were lost in the restore process) I would like to check-in my local workspace into the current restored snapshot so that my local workspace gets exactly the same as the snapshot (TFS server code repository). How can I do it?

I have thought to perform a "Get Latest version" on my local workspace in order to sync it with the snapshot (code repository). I understand that "Get Latest Version" will find the differences (and conflicts to resolve) between my local workspace and snapshot and then it will automatically check-out the necessary files so that I can review and check-in them later. Is that the correct way to proceed in this situation? Am I right? Also, as far as I know, doing a "Get Latest Version" don't delete the changes locally in my workspace, right?


Solution

  • Is that the correct way to proceed in this situation? Am I right? Also, as far as I know, doing a "Get Latest Version" don't delete the changes locally in my workspace, right?

    The answer is yes. This is indeed a feasible solution. But when we have a lot of files, this method seems to take a lot of time. We need to manually modify the necessary files one by one.

    Since the latest changes are in your local workspace, you could try to create a new workspace to sync latest version with the snapshot (code repository), then copy all the files in your local workspace to the new workspace and replace the same files.

    In this case, the modified files in the local workspace are present in the new workspace, and then we could submit and push (sync) those changes to the snapshot (code repository).