In more than one occasion, I found myself accidentally doing a git checkout /path/to/file
which erased my local change in the file, the changes were not added/committed.
Any way to undo that?
There is no way to undo that in git
.
However if you have the file open in your editor you can undo the changes there. Some editors like Emacs auto save files, so try looking for files with the same file name and a ~
or #
extensions.