Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have accidentally deleted a page from Azure DevOps Wiki. How can I recover it?

I have accidentally deleted a Wiki-page from our repository in Azure DevOps. (How) can I recover it?

like image 936
Mohammad Avatar asked May 31 '20 12:05

Mohammad


3 Answers

That is not an option for us, since we will loose many changes that were made after the last version no. up until the date I accidentally deleted the wiki page.

You can choose Clone wiki to download the wiki repo to local machine.

enter image description here

Then use git commands(git revert or what) locally to get the deleted page, once you find the deleted page, publish it and add it back to Wiki page as a new commit.

like image 164
LoLance Avatar answered Oct 16 '22 22:10

LoLance


Assuming you're managing a provisioned wiki (vs using published code as a wiki):

Look in the top-right corner for the vertical 3-dot menu, where there's an option to view revisions:

Hamburger menu to select revision history

Choose the revision you want to revert to (e.g. the one prior to deleting the needed wiki page), from the list (click on its version hash):

List of revisions and related hashes

From the revision details, select "Revert":

Option to revert to prior revision

At this point, your wiki should be at its prior state, and your wiki page should once again be available.

Note: If you're using published code as a wiki, you would recover/revert your changes as you would with any other code commit.

More details may be found here.

like image 30
David Makogon Avatar answered Oct 16 '22 22:10

David Makogon


I was just able to do this without too much fanfare. The resource that was helpful was this VS community topic. There is an answer that provides a solution that doesn't require you to clone the repo.

The key insight is that you can navigate to the Azure DevOps repo UI for the Git repo that's backing the wiki. The solution author says that the shape of the URL is something like https://dev.azure.com/<organization-name>/<project-name>/_git/<wiki-name>.wiki. This didn't quite work for me because we have a different URL scheme in our organization, but I was able to figure it out after a little trial and error. I later saw that you can get the URL by using the Clone Repo UI in the wiki - it gives you the URL, so you can just copy it and navigate to it.

Anyway, the steps were:

  1. Figure out the URL of the git repo that backs the wiki
  2. Navigate to the revision history for the entire wiki
    • the current UI shows you the Contents tab by default - switch to History
  3. Scroll until you find the commits that deleted the pages you want to restore
    • it's one of those list views that populate themselves as you scroll, so you won't be able to use the browser page search efficiently, unfortunately
  4. Revert the commits
    • In my case, this required clicking on them and creating pull requests to revert, but I was able to merge them myself without involving code reviewers. YMMV

All in all, not a wholly terrible experience, but completely undiscoverable.

like image 2
Tatiana Racheva Avatar answered Oct 16 '22 23:10

Tatiana Racheva