View wiki page history and revert changes

Azure DevOps Services | Azure DevOps Server 2022 | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018

You can see details of the changes made to a wiki page and revert to an earlier version, if needed.

View wiki page revision history

  1. To view the revision history of a page, select the Revisions link provided on each page. You can also select View revisions in the context menu of a page.

    Screenshot of the context menu showing Print, Link work items, View revisions, and Delete options. View revisions is highlighted.

  2. Revision pages show who made the change along with the revision message, date, and version or commit ID. To view details of a revision, select the message or version link.

    Page for a provisioned wiki page

    Home | Revisions lists revisions. The columns are Author, Message, Last Updated, and Version.

  3. Similar to any git file revision, the revision details page provides a Show diff side-by-side view or the Show diff inline view. Choose Preview to see the content of the page of the specific revision.

    Two revisions of an article are compared side-by-side. The article is in Markdown, and is titled Welcome to the Fabrikam Fiber wiki.

    For a publish as code wiki page, you see similar information, but Revert isn't active.

    Revision page for a publish as code wiki page

  4. Use the breadcrumbs to return to the page or revisions of the page.

Revert a commit to a provisioned wiki page

Select Revert on the revision details page to revert a change on a wiki page.

Note

The Revert option is available with TFS 2018.2 and later versions.

Dialog box Revert revision 701b5a9f has the Revert and Cancel options. Revert is selected.

Revert a commit to a publish as code wiki page

If you need to revert to an earlier revision for a page that you've published as code, do one of the following actions:

  • If the commit is the most recent revision to a page, you can revert from the web portal.
  • If the commit is an earlier revision, with additional commits having occurred in between, create a separate branch and revert the changes in that branch.

Revert from a recent revision from the web portal

  1. Preview any version by choosing the commit ID from the Revisions page for the selected file.

  2. Copy the full ID of the commit by selecting Copy-clone. Here we copy the commit ID, ca6d475a22eb1db930cf238f3b80862a78a689e4, with the abbreviated ID of ca6d475a.

    Copy the full commit id for an earlier commit

  3. Open the Repos > Commits page and paste the ID that you copied into the Commit ID box and choose Search.

    Paste the commit id for an earlier commit.

  4. From the commit page, select More actions, and then choose Revert.

    Choose revert menu option of an earlier commit

  5. Confirm that you want to revert. Choose Revert in the dialog.

    Revert commit dialog

    A branch is created with the reverted changes.

  6. Select Create Pull Request.

    Select Create Pull Request.

    If instead, you receive an error message as shown, it indicates that you must create a local branch and make your changes manually as described in the next section.

    Revert publish code as wiki error message

  7. Select Create in the New Pull Request form.

  8. Select Complete to merge the changes into the main wiki branch. Optionally, check the Delete checkbox to delete the intermediate branch.

    Revert publish code as wiki, complete pull request

Return to the wiki, refresh the browser, and you should see the reverted content.

Revert from earlier revisions using a different branch

To revert to an earlier committed version of a publish as code wiki page (one that isn't the immediate last revision), you must update a branch other than the main branch for the wiki, and then create a pull request to the main branch.

  1. Create a local branch of the main wiki branch.
  2. View the commit history and locate the commit that contains the changes you want to undo.
  3. Use the revert command to revert the desired commit.
  4. When a conflict arises, use the conflict resolution tools to resolve the issues.
  5. Commit the changes locally to your local branch.
  6. Push the local branch to the remote server.
  7. Create a pull request for your local branch into main.
  8. Complete the pull request.

You can use the following steps to identify the commit that contains the content you want to revert to. Then, use standard Git operations to revert the content.

For more information, see the following articles: