我有两个分支 master 和 development。我藏在主人身上,例如
git stash
git checkout development
现在,我在开发分支上,但错误地 pop 了存储
git stash pop
现在它显示冲突。我用这个重置了 git:
git reset HEAD
但是还是显示冲突。我还需要将我的藏品放回 master 分支。我该如何解决这个问题?
最佳答案
git reset HEAD
不会触及工作树,只会触及索引。实际上,它只会取消暂存文件,因为 HEAD
无论如何都是您当前分支所在的位置(这是 HEAD 的定义)。
git reset --hard HEAD
将修复工作树以反射(reflect) HEAD
。
如果 git pop
没有干净地应用,应该保留存储。
来自 man git-stash:
Applying the state can fail with conflicts; in this case, it is not removed from the stash list. You need to resolve the conflicts by hand and call git stash drop manually afterwards.
就这样吧:
git checkout master
git stash pop
#or `git stash apply` if you don't want to drop the stash even if it does apply cleanly
关于Git stash pop 在 master 分支上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30847089/