今天git更新代码时候,出现一个警告,然后本地新写的代码全部不见了。
git提示的完整内容:
Local changes were not restored
Before update your uncommitted changes were saved to shelf. Update is not complete, you have unresolved merges in your working tree Resolve conflicts, complete update and restore changes manually.
翻译:
本地更改未恢复
在更新之前,未提交的更改已保存到工具架。更新未完成,您的工作树中有未解决的合并解决冲突,完成更新并手动还原更改。
网上大家的做法是:https://blog.csdn.net/lj402159806/article/details/53925289
然而我这样操作的时候,UnStash Changes中找不到自己要恢复的代码了。
仔细看git给出的提示发现:
网上看到这里都是 to stash,我这里是to shelf。点蓝色shelf,看到自己之前写的代码了:
恢复办法:
选择你要恢复的内容,右键–>Unshelve
ok,丢失的代码回来了。以后update之前可以先commit到本地。