Undo delete in GIT

前端 未结 2 1328
渐次进展
渐次进展 2020-12-07 23:50

I made something very stupid. I made a commit using git commit (file edits + new files) (C). Then I made amend last commit. Then I deleted all files recursively (!) using

2条回答
  •  情深已故
    2020-12-08 00:34

    If I understood you correctly you rewrote commit C. So the original commit, let's call it C1 is not accessible from your commit graph, but it is still there (git keeps all commits for a while). Use git reflog to get the commit hash and git checkout or another appropriate command to get to the old state C1.

提交回复
热议问题