2

I lost some code after running

git reset --hard HEAD

and I never committed the work. Is there any way to get this code back? Was it logged anywhere? Can I undo the command?

2 Answers 2

6

Nope, git reset --hard and git checkout -f are both destructive of changes that haven't been committed.

0

Any uncommitted changes in your working directory ( including staged ) will be lost. That is why you should use it cautiously ( or use other flags like --mixed, --soft)

Not the answer you're looking for? Browse other questions tagged or ask your own question.