แก้ไข

แชร์ผ่าน


Roll back changesets

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Visual Studio 2019 | Visual Studio 2022

A Team Foundation Version Control (TFVC) changeset is a permanent part of the history of your version-controlled items and can't be undone or removed. However, you can roll back the effects of one or more changesets.

You can also use the tf command-line utility to roll back changes. For more information, see Rollback command (Team Foundation Version Control).

Prerequisites

You must be one of the Contributors for your project. For more information, see Default TFVC permissions.

Roll back changes from a single changeset

For example, a developer wants to remove the effects of a changeset:

Diagram that shows changes from one changeset.

To roll back a changeset from the Changeset Details page

  • Select the changeset, and on the Changeset Details page of Visual Studio Team Explorer, choose Rollback.

To roll back a changeset from the History window

  • In the Visual Studio History window, right-click a version and choose Rollback Entire Changeset.

To roll back a changeset from Source Control Explorer

  1. In Visual Studio Source Control Explorer, right-click an item and choose Rollback.

    Note

    The item you select determines the scope that the rollback changes.

  2. In the Rollback dialog box, select Rollback changes from a single changeset.

  3. Specify the changeset, and then select Rollback.

Roll back changes from a range of changesets

For example, a developer wants to remove the effects of some consecutive changesets:

Diagram showing multiple changesets.

To roll back a range of changesets

  1. From the History window, select two or more consecutive versions, right-click, and choose Rollback.

    Or, in Source Control Explorer, right-click an item and choose Rollback.

    Note

    The item you select determines the scope that the rollback changes.

  2. In the Rollback dialog box, select Rollback changes from a range of changesets.

  3. Specify the changeset range, and then select Rollback.

Roll back to a specific version

For example, a developer wants to roll back a file to an earlier version, eliminating the effect of all changesets that occurred after that version:

Diagram that shows a single changeset to roll back to.

To roll back to a specific version

  1. In Source Control Explorer, right-click an item and choose Rollback.

  2. In the Rollback dialog box, select Rollback to a specific version.

  3. Specify the version details, and then select Rollback.

Next steps