Can you undo 'git reset --hard HEAD' if never having made a commit?
I lost some code after running
git reset --hard HEAD开发者_如何学JAVA
and I never committed the work. Is there any way to get this code back? Was it logged anywhere? Can I undo the command?
Nope, git reset --hard
and git checkout -f
are both destructive of changes that haven't been committed.
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
)
精彩评论