Git: vscode stash drop accidentally deleted recovery/git stash drop recovery

Incident

This is really a must-have plot in the programmer version of horror movies: the local code that has been written for half a month and has not been submitted has been deleted! ! ! ah! ! ! ! ! ! ! ! ! ! !
Submit the code with the visualization tool of vscode today, and turn Pop Stash into Drop Stash…………………
Drop Stash, be careful!  !

rescue

At this time, of course, keep the scene of the crime, and then quickly ask Du Niang T┈T Du
Niang for the quick-acting heart-relief pills. The personal test is effective: How to restore the code after git stash clear/drop
Steps:
1. In the project folder Open git bash under;
Run Git Bash

2. Run the following command to view the latest stash ID:

git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

View stash ID

3. To restore the stash content according to the stash ID, run the following command (equivalent to git stash pop in the normal process):

git stash apply stashID

restore stash

Reference URL

[1] How to restore the code after git stash clear/drop

Guess you like

Origin blog.csdn.net/qq_36604536/article/details/126986155