Before doing anything else, please do these 3 steps - backup your local repo, tell the other guy to backup his, and backup the remote repo as they are now. Nothing fancy, just Ctrl+C, Ctrl+V would do. Do it on your entire project so you backup the working tree as well. If you don't have direct access to the remote server, a git clone
would have to suffice, though I would prefer a real directory copy.
Once you've done that, the other guy can use git push -f
to reupload his branch. If he has new commits, you will have to figure out which commit was last pushed by him, but I'm fairly sure no actual commits will be lost. If the other guy has done git pull -f
, even then he can use git reflog
to recover his local branch.
Since you're using Github, you might also see https://stackoverflow.com/a/35273807/492336. Apparently there is a Github’s Events API which might be useful.