Reputation: 369
Is there any way to redo changes in the working directory after checking them out? I just ssh'd into a server I hadn't been on in a while and saw that there were unstaged changes in the index. I assumed that this was just scratch work I had done last time, but figured because I didn't commit them they weren't important and ran:
$ git checkout .
to give myself a clean slate. Unfortunately this was a bit hasty, because it turns out that last time I was on this server I just forgot to commit, and the majority of the work I had done was in those changes.
I feel like this is a long shot, but is there any way to bring back these local changes to the working directory?
Upvotes: 2
Views: 87
Reputation: 1329782
Either those changes were:
staged (meaning added to the index), in which case a git fsck --full --unreachable --no-reflog
can help.
See for instance:
not staged (local private modification in the working tree): in which case, those modifications are lost.
Upvotes: 1