75

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

4 Answers 4

98

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

6
  • This is actually a better answer
    – Hoody
    Nov 20, 2012 at 10:09
  • 1
    Glad to help. You can also use the command line (tf.exe) to perform the rollback on a single file. Nov 20, 2012 at 19:34
  • 2
    Download for Visual Studio 2010 integration: visualstudiogallery.msdn.microsoft.com/… Jul 27, 2013 at 18:27
  • 6
    In newer versions of TFS, this is native functionality, so check before installing Power Tools
    – Aaroninus
    Sep 1, 2015 at 15:47
  • 3
    @LJNielsenDk It's the same way as described in the answer, just without the need for Power Tools (right-click file in Source Control Explorer)
    – Aaroninus
    Sep 25, 2015 at 11:44
40

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.

1
  • This normally works, but not if one of the other files that you don't need to rollback is locked by another user. Sep 27, 2016 at 9:11
28

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.

3
  • This also applies to Team Explorer Everywhere TFS plugin for Eclipse (only checked on v14)
    – ethesx
    Mar 31, 2016 at 15:34
  • This option doesn't exist for me in Solution Explorer. Either on the primary right click menu or under "Source Control" submenu
    – Ryan
    Oct 1, 2019 at 20:39
  • If you are reading this in 2019 I would suggest switching your repo to using git, there are tools available to copy the tfs check-ins history.
    – CularBytes
    Oct 2, 2019 at 10:00
4

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

1
  • ATTENTION: Don't do this if you have already files checked-out. This will create a huge mess in your workflow. I lost work because I had some files checked-out, then some files were the same as the ones I rolled back, and when I did Undo changes, I unintentionally undid my local changes previous to the rollback. :(
    – sergiol
    Jul 28, 2021 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.