'Restore local git repo deleted by git rm -f
I assume my files are gone but I'll try to ask anyway.
I started versioning a directory that had nested another directory with local git repo in it(which I made by mistake some time ago). I pushed the changes to GitLab but couldn't see the content of the nested directory there and it had a suffix @ 819bd776 in the name. Afterward, I accidentally removed the nested directory by git rm dir/ -f ...
Then I tried to restore it by git restore --staged dir and then git restore dir... The directory has been restored but with no content in it. Is there any way to save the contents of that directory?
Solution 1:[1]
Sadly not, git only saves what revision is checked out. The code after the @ is the hash of the checked out commit.
The only way to restore it, would be by using some kind of data recovery tool, or if the submodule/sub-repo was hosted somewhere else.
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 | VarChar42 |
