View wiki page history and revert

VSTS | TFS 2018

The Revisions page provides a convenient way to get details of the changes made to a wiki page. Optionally, you can choose to revert to an earlier version of a page.

View wiki page revision history

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

    Open revision history

  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, click the message or version link.

    Revision page for a provisioned wiki page, VSTS

    Open revision history

  3. Similar to any git file revision, the revision details page provides a side-by-side diff view or the inline diff view. You can also click Preview to view the content of the page as of the specific revision.

    Wiki revision details for a page

    For a publish as code wiki page, you'll see similar information, however the Revert button is not active.

    Revision page for a publish as code wiki page

  4. You can use the breadcrumbs to return to the page or the revisions of the page.

Revert a commit to a provisioned wiki page

Mistakes can happen while updating a wiki page. You can conveniently revert a revision and undo changes done on a wiki page. You can click on the Revert button 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.

Wiki revision details for a page

Revert a commit to a publish as code wiki page

If you find that you need to revert to an earlier revision for a page that you have published as code, you'll need to follow one of two paths. 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, you'll be most successful by creating a separate branch and reverting the changes in that branch.

Revert from a recent revision from the web portal

  1. You can 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 clicking the copy-clone icon. 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 Code>Commits page and paste the ID that you copied into the Commit ID box and click the search icon.

    Copy the full commit id for an earlier commit

  4. From the commit page, open the actions icon and choose the Revert option.

    Choose revert menu option of an earlier commit

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

    Revert commit dialog

    A branch is created with the reverted changes.

  6. Choose Create Pull Request.

    Revert commit dialog

    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. Choose Create in the New Pull Request form.

  8. Choose Complete to merge the changes into the master 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, one that is not the immediate last revision, of a publish as code wiki page, you must update a branch other than the master branch for the wiki, and then create a pull request to the master branch. The general steps are:

  1. Create a local branch of the master 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 master.
  8. Complete the pull request.

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

For more information, see the following topics: