案发经过
这真的是程序猿版恐怖片里必备的桥段了:写了半个月还没提交的本地代码被删了!!!啊!!!!!!!!!!!
今天用vscode的可视化工具提交代码,把Pop Stash点成了Drop Stash……………………
抢救
这种时候,当然是保持案发现场,然后速速去请度娘T┈T
度娘给的速效救心丸,亲测有效:git stash clear/drop 后代码如何恢复
步骤:
1、在项目文件夹下打开git bash;
2、运行以下命令,查看最近的stash ID:
git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
3、根据stash ID恢复stash内容,运行以下命令(相当于正常流程的git stash pop):
git stash apply stashID