Petr
Petr

Reputation: 15

TFS - overwrite files with their older version

Recently I inherited a project, source controlled on TFS. Let's say it had classes A.cs, B.cs and C.cs. I developed some new features - changed class C.cs and added classes D.cs and E.cs. I checked them in.

Then the project manager realized, that the previous developer made some changes to A.cs and B.cs and we do not want them in the production yet.

I backed up the project (localy), deleted my local copy of the project, got older version from TFS (get specific version), added new classes (D.cs and E.cs) and changed C.cs.

Everything worked fine. There was no problem. But after I checked-in the solution, I cannot build, because suddenly I have the new versions (not wanted) of A.cs and B.cs.

What were the right steps to solve this? How do I now "overwrite" A.cs and B.cs on the server with their older versions?

Upvotes: 1

Views: 2361

Answers (2)

The easiest way is to make A and B files that contain what you want and check them in over the top.

Revert is really only needed if you have a lot of files that are changed.

Upvotes: 1

Kapoor
Kapoor

Reputation: 1428

How do I now "overwrite" A.cs and B.cs on the server with their older versions?

Revert the changes done by the other developer to Class A & B in one check in. There are two ways of doing this step - manually or by using Rollback Command command.

Rollback Command :

I dont know which visual studio u r using but here is the url please select your vs version - https://msdn.microsoft.com/en-us/library/ms194956(v=vs.100).aspx

Manually:

a> Take specific version of A.cs & B.cs, one check-in prior to the wrong check-in by the other developer.

b> Check-out these files in your workspace.

c> Check-in both the files. U'll get conflicts in your pending changes window. Choose "Keep local" option to resolve the conflict & check in again.

You have reverted the changes to A.cs & B.cs

To verify if the revert is done correctly

view the history of A.cs (& later B.cs), in the history u'll see the check you just made. The check made by other developer & older checkins to the file. Select your checkin and check-in before the wrong check-in. Right click & choose compare. you should see a message "files are identical". That is you have reverted the changes made by other developer and the latest version is same as the older version of *.cs file in context.

Plz write me a comment incase of any doubt.

Upvotes: 1

Related Questions