Hoody
Hoody

Reputation: 3381

Rollback a single file in TFS

If I view the history of a single file in source control I can right hand click a change-set in the list and choose "rollback back entire change-set".

Will this rollback all the other files I checked in during that checkin or just the file I am currently viewing? If it does rollback all files is there a way to rollback just the file selected?

Thanks

Upvotes: 75

Views: 26843

Answers (5)

JanF
JanF

Reputation: 65

If you click on rollback the entire changeset, it will check out all of the items in the changeset to be rolled back. Then just go and undo checkout all other files that don't want to be rolled back. Then just check in the files you want to be rolled back.

Upvotes: 0

Pankaj Rawat
Pankaj Rawat

Reputation: 4573

Very simple workaround :) 1. rollback entire changeset 2. undo all file except file you actually want.

Upvotes: 4

CularBytes
CularBytes

Reputation: 10321

From now on, in visual studio 2015 atleast, you can just go to source control, right click a file and choose Rollback.. This will ask you what changeset you would like to rollback for this file and it will only rollback that file.

Upvotes: 28

Assaf Stone
Assaf Stone

Reputation: 6317

As previously mentioned, rolling back the changeset rolls it back in its entirety.

Installing Team Foundation Power Tools (which I think pretty much everyone should install) gives you another option: If you want to rollback a single file, you can right click a single file in the Source Control Explorer and select Rollback...

Upvotes: 99

DaveShaw
DaveShaw

Reputation: 52788

Yes, rolling back the entire changeset will roll back all the changes in it.

However, a Rollback is not instant, when you click that option the rollback will be perform a reverse merge and leave the changes in your workspace. So you can look at them in Pending Changes.

In your case, just perform the Rollback and then undo everything except the file you actually want to Rollback.

Upvotes: 40

Related Questions