'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?
Solution 1:[1]
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.
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.
Solution 2:[2]
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:

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):

From the revision details, select "Revert":

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.
Solution 3:[3]
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:
- Figure out the URL of the git repo that backs the wiki
- Navigate to the revision history for the entire wiki
- the current UI shows you the Contents tab by default - switch to History
- 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
- 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.
Solution 4:[4]
I couldn't find a way to do this through the Azure DevOps web interface but you can restore the page by reverting the commit that deleted it if you clone the wiki locally.
- Clone the wiki to your computer - find the clone wiki option in the menu at the top of the left bar which shows the wiki contents, copy the URL and use to clone locally using your usual git client.
- Find the commit that deleted the page, the commit message will start with "Deleted page" then the name of the page you deleted.
- Restore the page and commit the change. There are various ways to do this - I reverted the commit, you could checkout the commit and copy the page out to make a new commit. You may get a merge conflict on '.order', I'm not sure what the best thing to do is but I kept the current version and haven't had any problems.
- Push the changes to Azure DevOps, refresh and you'll see the page has been restored.
This works even for Project Wikis. I wonder if Azure DevOps has added the functionality that enabled this since some of the other answers have been written.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | LoLance |
| Solution 2 | |
| Solution 3 | |
| Solution 4 | rich3948756410927 |

