How to: Roll Back a Changeset

If you accidentally check in changes or accidentally delete files, you can correct these mistakes. You can revert to an earlier version of a file for which you checked in changes, or you can restore a file that you deleted.

Required Permissions

To perform these procedures, your Check out permission must be set to Allow. For more information, see Team Foundation Server Permissions.

To revert to an earlier version of a file

  1. In Source Control Explorer, right-click the file that you want to roll back, and then click Get specific version.

    The Get dialog box appears.

  2. Under Type, click Changeset.

  3. Under Changeset, click the ellipses (…).

  4. In the Find Changesets dialog box, either use the default values or specify criteria for your search, and then click Find.

  5. Under Results, click the changeset that contains the version to which you want to revert the file, and then click OK.

  6. In the Get dialog box, select the Overwrite writable files that are not checked out check box, and then click Get.

    The earlier version of the file is copied to your local working folder.

  7. In Source Control Explorer, right-click the file, and then click Check Out for Edit.

  8. In the Check Out dialog box, click Check Out.

  9. In Source Control Explorer, right-click the file again, and then click Check In Pending Changes.

  10. In the Check In - Source Files dialog box, click the file, and then click Check in.

    The Resolve Conflicts dialog box appears, and a message explains that no files have been checked in because the two versions have changes that conflict.

  11. In the message box, click OK.

    The Pending Changes – Conflicts window appears.

  12. (Optional) In the toolbar of the Pending Changes window, click Compare Local to Server.

    The server and local copies appear side by side so that you can review your decision before you roll back the changes

  13. In the Pending Changes window, click Keep Local Version.

  14. In Source Control Explorer, right-click the file, and then click Check In Pending Changes.

  15. In the Check In - Source Files dialog box, click Check in.

To restore previously deleted files

  1. On the Tools menu, click Options, click Source Control, and then click Visual Studio Team Foundation Server.

  2. Select the Show deleted items in the Source Control Explorer check box.

  3. In Source Control Explorer, right-click the deleted file, and then click Undelete.

  4. Right-click the file again, and then click Check in Pending Changes.

  5. In the Check In dialog box, select the check boxes for any files that you want to restore, and then click Check In.

See Also

Concepts

Submitting Changes to the Version Control Server

Other Resources

Resolving Folder Differences and File Conflicts (Team Foundation Version Control)