Skip to content

Instantly share code, notes, and snippets.

View akshitkrnagpal's full-sized avatar
🏠
Working from home

Akshit Kr Nagpal akshitkrnagpal

🏠
Working from home
View GitHub Profile
@agarwalparas
agarwalparas / gist:d355a950148702cc7ba82abc4d1943bf
Created November 3, 2017 04:06
Recover Force Push on Github
# First, you must get the previous commit sha, the one before the forced push:
## Hit through terminal
curl -u <username> https://api.github.com/repos/:owner/:repo/events
# Then you can create a branch from this sha:
## Hit through terminal
curl -u <github-username> -X POST -d '{"ref":"refs/heads/<new-branch-name>", "sha":"<sha-from-step-1>"}' https://api.github.com/repos/:owner/:repo/git/refs