I commited a wrong file, so I wanted to clean it up, but accidentally I overwrote all my files in the directory with last files committed to git.
Help please!
What I did:
git add fileIdidnotwanttoadd
git rm -r --cached .
git reset --hard HEAD
result: All my fixes are gone! I fixed 3 very hard bugs and it’s all gone!
Edit:
Thank you all. I used most of your suggestions, still had to redo a few things, but all is restored now. No more perfectionism, I learned my lesson!
(from: Recover from git reset –hard?)
You cannot get back uncommitted changes in general, so the real answer here would be: look at your backup. Perhaps your editor/IDE stores temp copies under /tmp or C:\TEMP and things like that.[1]
This will restore to the previous HEAD – in case you had something committed earlier
[1]
such features might save your a**