18

I accidentally rolled back an entire changeset. How can I undo that operation, and restore the changeset?

S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
Eccentropy
  • 444
  • 1
  • 4
  • 11

4 Answers4

17

If you select "Rollback Entire Changeset" in TFS, it changes the local files so that the changes made in the changeset are reversed.

Since this is a local change and does not take effect until you check the changes in, you can "undo" the rollback by using "Undo pending changes" on your project. Note this will also mean any other uncommitted changes would also be lost, so use with care.

Quango
  • 12,338
  • 6
  • 48
  • 83
  • the "use with care" warning is appropriate. when other changes like edits are already done and havent been checked in yet, they are gone too. In this case the only solution will be to have the files with edits copied somewhere locally, then "undo changes", check out the files that have been changed before and copy the files back in, THEN check them in. Yet I find it an severe fault that you can not undo a rollback as its own operation without affecting other changes. – Hefaistos68 Jan 12 '21 at 09:43
5

You can always "View History" and retrieve a particular Changeset...

  • Please be more specific - do you mean using "Get This Version"? If so, this doesn't actually change the files affected by the rollback. E.g. I currently have files with statuses such as [delete, rollback] and [edit, rollback] after doing this - these were unchanged afterwards. – Steve Chambers Apr 24 '13 at 08:35
  • 8
    I just worked this out. Rollback had the effect of changing the files locally so to restore them (i.e. "undo the rollback") all that was needed was to undo the changes using "Undo..." – Steve Chambers Apr 24 '13 at 08:42
2

Get the Latest version and Rollback the earlier roll-backed change set and now they get checked out and now check in the changes after required modifications.

DBalaji
  • 61
  • 1
  • 5
-1

Alternatively you can use the following command in visual studio command window: tf rollback /changeset:changeset_number