Description
I encountered an issue where all files in my JavaScript project folder (D:\JavaScript_Repo) were deleted after running: git reset --hard
I was trying to fix some line ending warnings (LF will be replaced by CRLF), and ran git reset --hard to clear changes. But it seems to have removed all my project files (not just untracked ones).
What I Did
- Cloned repo using Git Bash/PowerShell.
- Installed
node_modules.
- Got repeated warnings like: warning: LF will be replaced by CRLF the next time Git touches it
- Ran
git config --global core.autocrlf true
- Then ran: git reset --hard
But after that, most of my files and folders were deleted, including node_modules, src, etc.
🔍 What I’ve Tried
- I checked
git reflog — but couldn't recover untracked files.
- Using
PhotoRec now, but it’s hard to recover the exact folder structure.
- I want a safer or Git-based method if available.
❓ What I Need Help With
- Is there any way to recover the files removed by
git reset --hard?
- Can GitHub/Git help in recovering untracked but deleted files?
- What are the safest practices to avoid this kind of loss in the future?
🧠 Additional Info
- Windows 10
- Local repo, not published on GitHub yet
- Files were not committed before deletion
🙏 I’d really appreciate guidance on recovery options (Git or non-Git) — this is a serious project loss for me.
Description
I encountered an issue where all files in my JavaScript project folder (
D:\JavaScript_Repo) were deleted after running: git reset --hardI was trying to fix some line ending warnings (
LF will be replaced by CRLF), and rangit reset --hardto clear changes. But it seems to have removed all my project files (not just untracked ones).What I Did
node_modules.git config --global core.autocrlf trueBut after that, most of my files and folders were deleted, including
node_modules,src, etc.🔍 What I’ve Tried
git reflog— but couldn't recover untracked files.PhotoRecnow, but it’s hard to recover the exact folder structure.❓ What I Need Help With
git reset --hard?🧠 Additional Info
🙏 I’d really appreciate guidance on recovery options (Git or non-Git) — this is a serious project loss for me.