Search code examples
gitgithubgit-mergegit-submodulesgit-merge-conflict

Git manual merge issues


So what I want to do is: There is an old branch foo with some changes that I want in a new branch. Here's what I did:

I created a new branch bar based off of the branch foo and wanted to merge changes from the current working branch baz into bar. Now I did:

git fetch origin
git checkout -b "baz" "origin/baz"
git merge "bar"

There were a few conflicts that I have resolved manually and I have now staged these changes but it won't let me stage some submodules, I get:

$ git add path/to/submodule/qux
error: unable to index file path/to/submodule/qux
fatal: updating files failed

why is this and how do I get these merged, staged & committed? It's okay to just use the latest submodule as they are present in baz.

When I do $ git submodule update --init --recursive, I get Skipping unmerged submodule path/to/submodule/qux and when I cd there, the direcory is empty...


Solution

  • First run reset :

    git reset HEAD path/to/submodule/qux
    

    You can then choose whichever version suits you for this submodule