git deleted everything, how to recover files and folders

后端 未结 3 1531
半阙折子戏
半阙折子戏 2021-01-12 02:25

It was the first time that I was using git, I wanted to import an existing project into github and everything was deleted. After search for an answer I think git deleted the

3条回答
  •  粉色の甜心
    2021-01-12 02:42

    As you already have a reference to a dangling tree object, you're well on your way. The following should work: first recover the dangling tree into Git's index:

    git read-tree bfe11a30d57a0233d3b0c840a3b66f6421987304
    

    Next, update your working directory from the now-recovered index:

    git checkout-index -a
    

提交回复
热议问题