'Recover the Deleted files from GIT OR SVN
I had a folder structure with multiple projects in Visual Studio. I committed a few in my old Repo of SVN. And when I added a few more projects, we decided to move to Git.
While creating a new repo in Git and checking in, by mistake, I ran a Git reset --hard and it deleted all the files from local.
These files do not exist in either SVN or Git repo.
I tried to restore using the git fsck --lost-found, git show , git merge, git reflog. But none of that works. It always shows me the whole list of files in Deleted.
I ran the git show 4825b63f49cea10539a4c27a6287e195d3d087b2 > 4825b63f49cea10539a4c27a6287e195d3d087b2.txt after running git reflog. And the text file does contain all the files with its code. But I am not able to restore it.
Before I started with Git, the code was connected with SVN but may not be committed.
Is there any way I can restore the code from Git or SVN?
Solution 1:[1]
If 4825b63f49cea10539a4c27a6287e195d3d087b2 is a commit, you can try at least
cd /path/to/repo
git restore 4825b63f49cea10539a4c27a6287e195d3d087b2 -- .
See if the content of that commit is visible then.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VonC |
