1

My changes were gon after I run command git checkout -f

Is there a way to recover my changes?

I did not commit my changes and also it's unstaged.

phd
  • 82,685
  • 13
  • 120
  • 165
Dmo3
  • 48
  • 7
  • Possible duplicate of [Can git undo a checkout of unstaged files](https://stackoverflow.com/questions/2689265/can-git-undo-a-checkout-of-unstaged-files) – phd Apr 23 '19 at 09:50
  • https://stackoverflow.com/search?q=%5Bgit-checkout%5D+uncommitted – phd Apr 23 '19 at 09:51

1 Answers1

3

The way to recover your changes won't be git, since files were not committed.

However, you could recover them, provided you're using a sufficently advanced IDE with local changes save feature.

If not, the picture might be grim, but it's hopefully a lesson to remember : commit often, even on temporary branches when you're unsure.


edit after comments :

Good news, you're on PhpStorm. (you seem to know how to proceed already, I'm just adding it for the record here)

enter image description here

Let's note that most modern IDEs have similar functionality.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61