Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

Can you recover uncommitted changes lost by `git reset --hard` or `git checkout .`?

IntermediateConceptUndoing changes: reset, revert, restore and reflog
Answer

Not from the reflog, since they were never committed. Anything that was ever staged (git add) exists as a dangling blob and can be found with git fsck --lost-found. Unstaged edits are gone unless an IDE local history has them.

git fsck --lost-found
ls .git/lost-found/other
All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog