开发者

Can you undo 'git reset --hard HEAD' if never having made a commit?

开发者 https://www.devze.com 2023-03-22 06:40 出处:网络
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, gi

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消