11

I deleted a page on a github repo's wiki.

Clicking on the link to the file now brings me to a new edit screen. I thought this might be in my fork of the repo, but following the link in incognito mode on chrome gives me the error that I do not have permission to edit this file (presumably because I am trying to create it and I am not logged in in incognito).

I know you can revert changes in files, but how do I revert deleting a file on a github repo's wiki?

Boris Verkhovskiy
  • 14,854
  • 11
  • 100
  • 103

1 Answers1

23

You can clone the wiki repo of your project, and restore that page locally.

git clone https://myusername@github.com/myusername/foobar.wiki.git
git checkout $(git rev-list -n 1 HEAD -- yourPage)^ -- yourPage

Then you push back to the wiki repo on GitHub: that should allow it to display your page again.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    In case you need to restore older wiki page, you could run: `WIKI_PAGE_NAME="Insert name of the page here" git checkout $(git log | grep "$WIKI_PAGE_NAME" -B 4 | head -n 1 | awk '{print $NF}')` – jirislav Dec 03 '16 at 23:00