Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve git merge conflicts on a submodule from `git stash pop`

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
like image 771
Mashmagar Avatar asked Feb 23 '15 20:02

Mashmagar


1 Answers

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.

like image 165
Ken Thomases Avatar answered Sep 22 '22 17:09

Ken Thomases