Search code examples
gitgit-reset

git reset --hard HEAD~1


Is there any chance of recovering files that were not committed before this command? I used this command instead of --soft.... I am working on Linux/Visual Studio code

035e859 HEAD@{23}: reset: moving to HEAD~1
3704540 HEAD@{24}: commit: [TA-4] Creating a form onf Frontend that allows you to add TodoList
035e859 HEAD@{25}: commit: [TA-4] Creating a Controller that supports adding TodoList
5b1623d HEAD@{26}: commit: [TA-4] Project Configuration
c77dcb0 HEAD@{27}: commit: [TA-4] Adding Api Platform To the Project

I tried using the git reset --hard HEAD@{23} command, but unfortunately, I didn't get back the files that weren't committed.


Solution

  • If you never committed the files you're trying to get back, no git command will be able to recover them. Unless you have some other form of backup, I fear you're out of luck. Visual Studio Code's local history may be able to help you, but I'm not familiar with it enough to suggest anything concrete.