转载地址:https://www.jianshu.com/p/efb9f2f1bd05
1.查找stash commit id
git log --graph --all --decorate --oneline
--graph意思是以图形的模式显示分支,
--all意思是显示所有的commit记录,
--decorate参数用来显示一些相关的信息,如HEAD、分支名、tag名等,
--oneline就是一个commit只显示一行
2.切换到该分支
git checkout 第一步查找出的commitid
3.reset 该commitid
git reset HEAD~1
4.保存修改到stash中
git stash
5.切换到之前的分支
git checkout 分支名称
6.pop stash即可
git stash pop