1

On one Github repository, I maintain a somewhat extensive list of tips that I don't want to go looking up many time. I have local clone of that Wiki.

By mistake, I made a git push --force origin branch before updating the local repository (e.g. with git fetch).

I have read the specific answer on How to recover from a git push -force?. And ran

curl -u <username> https://api.github.com/repos/<user>/<repo>/events

However, since it concerns the wiki, AFAICT, I can only check the events on the main repository (<repo>). Which appear marked as GollumEvent. But they don't have a specific hash, so I cannot follow by creating a new branch/ref for it.

Since I never updated the local directory, I also cannot use the direct reflog way.

I tried getting the events of <repo>.wiki or <repo>.wiki.git, but the API claims that it is unknown. I tried having a look at the commits list, but it only lists the commits to the main repo (not wiki).

Do I still have a chance to recover the last online edits?

clem steredenn
  • 352
  • 7
  • 20

1 Answers1

0

First, try to look at the reflog with git reflog and see if you can find the missing commit. You could also try git reflog refs/remotes/origin/branch to see if you have that commit in an older version. However, remote tracking branches may or may not have reflogs associated with them, depending on your repository settings, so that may not work.

Note that the GollumEvent entries do have a hash with them under payloadpagessha, which you could also use.

If you can't find it anywhere in your repository and can't find the appropriate GollumEvent entry, you can contact GitHub Support and they can look up the old value and create a reference with that commit.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • I tried to have a look a the `reflog`, and I can see the commits before I updated them locally. But the online editions of the wiki are missing (since I forgot the `fetch`). And the sha you mention, is the one of the page, not the one of the specific commit. As such, when I tried to create a reference using that hash (as per the mentioned answer), it says that it cannot be found. – clem steredenn Apr 30 '20 at 06:53
  • Okay, then it sounds like you should contact GitHub Support, who can recover that information from their logs and create a reference with the old commit. This is not an unusual request for them. – bk2204 Apr 30 '20 at 22:54
  • Ok, will do. Thanks. – clem steredenn May 01 '20 at 14:45