简体   繁体   中英

Removed main commit in github repo

Help guys, I just did a git reset on my main commit in a git repo, now the whole project has gone back to the start?

When i do git reflog i can see my previous commits still, how can i move to one of them and restart from there.

Anyway, I can recover this? Major error

Create a new branch, check it out and then reset it to the commit you see in the reflog:

git branch recover
git checkout recover
git reset --hard <commit-from-reflog>

This should give you the state you had at that point, including in the working directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM