jurgenb
jurgenb

Reputation: 472

TFS: merging changes from a single file back into the latest version

Consider the following problem. You remove code from a file in changeset 10. Later on you realise that code should not have been removed, and you want to merge it back into your latest version.

How do you do that with TFS with Visual Studio?

With (Win)CVS that's as simple as selecting the file and using the update command's merge options to merge the changes from an older revision back into your latest version. In TFS I can't figure out how to do this.

Using the "Get specific version" option seems to be overwritting my recent changes without allowing me to merge.

For now the only option I seem to have is to get the file old file manually from the changeset and merge the changes back using a diff tool on the latest version.

Upvotes: 3

Views: 2612

Answers (2)

Richard Berg
Richard Berg

Reputation: 20784

tfpt rollback file.cs /changeset:10

See tfpt rollback /? for more options.

You could do the same thing with a series of built-in commands -- tfpt only calls public APIs -- but unless you are really comfortable with the 3-way merge/conflict/resolution terminology that TFS uses, it's far less error prone if you let a tool handle it.

The downside is that it's quite slow. (for safety's sake, it syncs your entire workspace first, even if you're only touching 1 file) The rollback built into TFS 2010 executes on the server and is thus able to be much more intelligent.

Upvotes: 1

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65391

You could try and trigger a merge conflict, in order to get the merge tool to run.

On your machine get spesific version, add a space and save.

On some one elses machine, get latest version, add a space, save and checkin.

On your machine, try and checkin, this should give you a merge confict and start the merge tool.

Upvotes: 0

Related Questions