Rollback a single file in TFS

Tfs

Tfs Problem Overview


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

Tfs Solutions


Solution 1 - Tfs

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...

Solution 2 - Tfs

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.

Solution 3 - Tfs

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.

Solution 4 - Tfs

Very simple workaround :)

  1. rollback entire changeset
  2. undo all file except file you actually want.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHoodyView Question on Stackoverflow
Solution 1 - TfsAssaf StoneView Answer on Stackoverflow
Solution 2 - TfsDaveShawView Answer on Stackoverflow
Solution 3 - TfsCularBytesView Answer on Stackoverflow
Solution 4 - TfsPankaj RawatView Answer on Stackoverflow