DEV Community

Discussion on: git reflog saved my ass.

Collapse
oligospermia profile image
Mesalazine

reflog can even help when you accidentally drop/clear stashed changes (those that weren't even committed really yet).

Collapse
leanminmachine profile image
leanminmachine Author

? how does it work if the changes arent committed or stashed somewhere..?

Collapse
oligospermia profile image
Mesalazine

Well changes should be in the stash of course. Then you accidentally lose it (via git stash clear or git stash drop). However, even if changes weren't committed, they still do have some hash tags in the repository, they are stored as so called "dangled commits". So all you have to do is find such hash and apply it via stash command to restore. You can see an example here:

stackoverflow.com/questions/89332/...

Thread Thread
leanminmachine profile image
leanminmachine Author

nice, thanks for the link!