我有一个带有子模块的git存储库。我需要弹出我以前藏过的更改。但是,这会导致子模块引用上的合并冲突。
除了子模块之外,我希望将更改从存储区中保存下来。对于大多数代码文件,我可以通过编辑冲突的文件来解决冲突,但这似乎不是子模块的选项。
如何解决合并冲突,并仍然从隐藏中提取更改?
$ git stash pop
warning: Failed to merge submodule some-submodule (commits don't follow merge-base)
Auto-merging some-code
Auto-merging some-submodule
CONFLICT (submodule): Merge conflict in some-submodule$ git status
# On branch some-branch
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: some-code
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: some-submodule发布于 2015-02-23 20:37:18
正如git status评论所述:git reset HEAD some-submodule。
顺便说一句,在您再次检查了您的树和索引是否应该是它们之后,您可能希望使用git stash drop。git stash pop通常会这样做,但在发生冲突时不会这样做。
发布于 2019-04-04 14:53:36
我正在寻找一种更干净的解决方案,但最终编辑的内容变得更简单了。YMMV
git stash show -v > foo
$EDITOR foo
(remove the fluff you don't want)
git apply < foo在我的例子中,简单地删除“子项目提交”和相关的diff行就可以了。
https://stackoverflow.com/questions/28682919
复制相似问题