git ------git stash drop 储藏数据意!外删除后,如何恢复?!!

废话不多说,上代码!!!

一. 项目根文件终端里输入:(git fsck --lost-found)

git fsck --lost-found

展示所有被删除的数据

PS D:\前端项目\webstromfiles\meituan> git fsck --lost-found
Checking object directories: 100% (256/256), done.
dangling commit 028d9a491e842e5b2d6d29b30b0076bff7b05869
dangling tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904

二.第二步就是查看对应commitID下的文件变化,确定对应要恢复的数据列(git show commitID)

git show 6058203bd507f8aa962bf08eda3be4f3e7a6bc56 


示例如下:

PS D:\前端项目\webstromfiles\meituan> git show 6058203bd507f8aa962bf08eda3be4f3e7a6bc56
commit 6058203bd507f8aa962bf08eda3be4f3e7a6bc56 (HEAD -> master)
Merge: 9189eb2 dacb6eb
Author: liyangtao 
Date:   Mon Jun 29 10:14:55 2020 +0800

    WIP on master: 9189eb2 美团详情页

diff --cc pages/products.vue
index 1194780,1194780..c06c629
--- a/pages/products.vue
+++ b/pages/products.vue

三. 第三步就是恢复对应数据到当前分支(git merge commitID)

git merge c358cc7ce8699310247c72562b218cc7e21310a3


结果如下:
Updating 01de2a4..c358cc7
Fast-forward
 src/views/error-page/404.vue | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
...

 

你可能感兴趣的:(git,知识点总结,面试总结)