I have a git repository with a submodule. I need to pop changes I've previously stashed. However, this is causing a merge conflict on the submodule reference.
I want to keep my changes from the stash, except for the submodule. For most code files, I can resolve the conflict by editing the conflicting file, but that doesn't seem to be an option for the submodule.
How can I resolve the merge conflict and still extract my changes from the stash?
$ 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
As the git status
comments say: git reset HEAD some-submodule
.
By the way, after you've double checked that your tree and index are how they should be, you will probably want to git stash drop
. git stash pop
would normally do that, but doesn't when there are conflicts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With