If you've made a wrong forceful push or just want to recover from old commits in github, then you can use this command flow:
# find the commit, just like git reflog
curl -u <username> https://api.github.com/repos/:owner/:repo/events
# create a new branch from the commit sha found in previous step
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