今天在準(zhǔn)備提交代碼時,先執(zhí)行了webstorm的upadte功能玫鸟,執(zhí)行完之后發(fā)現(xiàn)所有新增和有改動的代碼都消失了导绷,直接被覆蓋了。webstorm event log里提示:
Local changes were not restored
Before update your uncommitted changes were saved to stash.
Update is not complete, you have unresolved merges in your working tree
Resolve conflicts, complete update and restore changes manually.
大致意思是本地merge失敗屎飘,本地的改動被保存到一個stash存檔里
解決方案:
查看存檔列表:git stash list
讀最新存檔:git stash pop
讀指定存檔:git stash apply stash@{存檔編號}
如:git stash apply stash@{0}
但是讀取存檔時依舊報錯妥曲,之后我再執(zhí)行g(shù)it add .,然后執(zhí)行 git commit钦购,最后再執(zhí)行上述讀取存檔操作就成功了檐盟,被覆蓋的代碼也恢復(fù)了。
所以以后提交代碼時一定要先commit押桃,再push