Recovering Uncommitted Files After Git Reset

Posted on Apr 2, 2017

You may have a very painful memory. Yes, I will now tell this painful story…

I was working on a project (experimental) again. I worked hard for 2 nights and got a successful result. I said, let me create a repo on Github (private) for this and I did. I added my remote URL and…

git add .
#........

After adding the files, I said wait, let me first ignore the vendor, etc. by reverting it.

git reset --hard
#......... 😨

I said and at that moment, I experienced the regret of losing all the files. I started to sweat coldly. I immediately googled recover uncommitted files after git reset –hard and so on…

I found this stackoverflow answer: http://stackoverflow.com/a/7376959/6668082.

Thank goodness, since I lost only 3-5 files (a small number), I found the files I had to recover one by one by saying git show xxxxxxx for each dangling blob, and I saved them.