Could not restore untracked files from stash caused by git stash save -a

Reprint address: https://www.jianshu.com/p/efb9f2f1bd05

1. Find the stash commit id

git log --graph --all --decorate --oneline

--graph means to display branches in graphical mode,

--all means to display all commit records,

The --decorate parameter is used to display some related information, such as HEAD, branch name, tag name, etc.

--oneline is a commit that only displays one line

2. Switch to this branch

git checkout 第一步查找出的commitid

3. reset the commitid

git reset HEAD~1

4. Save the changes to stash

git stash

5. Switch to the previous branch

git checkout 分支名称

6. Just pop stash

git stash pop

Guess you like

Origin blog.csdn.net/gao_yuwushengchu/article/details/124128997