can i restore a .git file after rm-rf?

后端 未结 4 1643
北恋
北恋 2020-12-21 21:06

I needed to pull the master branch but was having issues merging it into my local master and so thought it expeditious to simply rm -rf the entire folder. This was the great

4条回答
  •  心在旅途
    2020-12-21 21:22

    .git is actually a folder containing your local repository. In deleting that you deleted your history.

    If you removed only the repository (the .git folder) and not the parent source directory, the latest versions of your code files should still be present in the source directory. If you removed the whole source folder along with the repository you need to look at restoring files.

    As you're on Windows, if you have no backup, system restore might be your only option.

    • Right click on whatever parent folder you have (either the source directory, or if that's gone, the folder that contained it).
    • Go to the Previous Versions tab and see if you have a previous version of the folder there.

    You may not get a full recovery but if you have a recent image you may get some of your work back.

    If you get no luck with that you'll need to do more research on file recovery. There are apps available. I'd recommend not writing to the disk any more than you have to (preferably not at all) if that is the route you need to go.

提交回复
热议问题