这个问题 https://stackoverflow.com/questions/20038056/undo-git-stash-pop有相同的标题,但它是NOT同样的问题。这个问题实际上是在问“丢弃 git stash pop 的结果”。这个问题其实是
UNDOgit stash 流行
换句话说
// in branch foo
git stash
git checkout bar
git stash pop # ERROR. I didn't want to pop on top of bar, lots of conflicts
git stash undo-pop # NEED COMMAND TO PUT STASH AND LOCAL FILES BACK AS THEY WERE
git checkout foo
git stash pop
有没有办法让一切恢复到我打字之前的状态git stash pop
?换句话说,实际上UNDOpop 并将隐藏的内容放回到存储中,并将本地文件恢复到我输入 git stash pop 之前的状态。
这也不是一个骗局如何恢复 Git 中丢失的存储? https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git尽管这在某些情况下可能会有所帮助
在您的示例中,恢复到之前的状态git stash pop
, use:
git reset --hard bar
这种形式的git reset
命令恢复索引的状态and工作目录到头部bar
branch.
因为你们一开始就有矛盾git stash pop
,藏匿处remains在存储堆栈的顶部。
从那里,您可以git checkout foo
and git stash pop
again.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)