2

I was working on a component, I did git reset --hard and I lost the changes, I did not commit them.

Is there a way to recover those changes?

I am using VSCode, is there any history or something I can do?

Non
  • 8,409
  • 20
  • 71
  • 123
  • @vanza I did not commit the changes. I just lost them so it is a duplicate. – Non Dec 07 '17 at 21:47
  • @OnorioCatenacci I did not commit the changes. I just lost them so it is a duplicate. – Non Dec 07 '17 at 21:47
  • I need to know how to recover what I didn't commit, like something in the history or something like that. – Non Dec 07 '17 at 21:47
  • 4
    In that case you just lost them. – vanza Dec 07 '17 at 21:49
  • I think you're just out of luck. Unless VSCode keeps a temporary copy somewhere there's no way to recover the changes. – Onorio Catenacci Dec 07 '17 at 21:50
  • @NietzscheProgrammer Onorio’s suggestion involves uncommitted changes as well. – Daniel H Dec 07 '17 at 21:59
  • @OnorioCatenacci It looks like [VS Code *does* save backups](https://stackoverflow.com/q/42635755/27302) for a crash, but I can’t find anything about whether it keeps those files if shut down properly or if it overwrites them when Git changes the files. – Daniel H Dec 07 '17 at 22:01
  • This should not have been closed. While we already know the answer about git (git provides no way to recover), the fact is that VS Code *does* offer some ways of recovering seemingly lost changes. For example, if you happened to have the files open in the editor when you ran your reset, then you can use edit-undo to get back to the previous version of the file. – JDB Jul 20 '18 at 19:38

0 Answers0