我有两个分支,硕士和开发部。我藏在主人身上。
git stash
git checkout development现在,我在开发部门,但我错了,我把藏起来了。
git stash pop现在它显示出冲突。我使用以下方法重置git:
git reset HEAD但它仍然显示出冲突。我也要把我的藏品放回支行。我怎样才能解决这个问题?
发布于 2015-06-15 14:09:26
git reset HEAD不会触及工作树,只会触及索引。实际上,它只是不分阶段的文件,因为HEAD是您当前分支已经存在的地方(这是HEAD的定义)。
git reset --hard HEAD将修复工作树以反映HEAD。
如果git pop应用不干净,则应该保留存储。
来自man stash:
应用状态可能会因冲突而失败;在这种情况下,它不会从存储列表中删除。您需要手动解决冲突,然后手动调用git。
所以就这么做吧:
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发布于 2015-06-15 16:03:52
尝试使用以下方法查看git存储手册:
git stash --help它有一个章节,说明万一你不小心清理掉了仓库,该怎么做。这将有助于理解在这种情况下要做什么。
Recovering stashes that were cleared/dropped erroneously
If you mistakenly drop or clear stashes, they cannot be recovered through the normal safety mechanisms. However, you can try the
following incantation to get a list of stashes that are still in your repository, but not reachable any more:
git fsck --unreachable |
grep commit | cut -d\ -f3 |
xargs git log --merges --no-walk --grep=WIPhttps://stackoverflow.com/questions/30847089
复制相似问题