Search code examples
gitlocalgit-checkoutundo

Git checkout -- recover lost files


I accidentaly deleted local file changes on git repository. They were NOT commited or even pushed.

What I did: git status (then files not staged for commit showed and I accidentaly removed whole folder called "smdr" by this comand): git checkout -- smdr

Then files changes disappeared.

How can I recover those files (birng everything back before that git checkout -- smdr comand)?


Solution

  • You can't with Git. The files were not committed so they are not in history. You just got the (inexistant) version in the index with git checkout.

    Your only hope is your backup system.