Restore any GitHub tree after you accidentally force push.
- Clone this repo and
cd
to it. - Find the
SHA
string of the tree you'd like to restore by accessinghttps://api.github.com/repos/<your_username_or_org>/<repo>/events
. - In the
payload
property corresponding to your push event, find thecommit
you'd like to revert to and click on itsurl
. - Under
commit.tree
, copy thetree
'surl
. - Run
python3 main.py <tree_url> <path_to_save_to>
.
Example:
python3 main.py https://api.github.com/repos/<username>/<repo>/git/trees/<tree_sha> .