How to solve 'error: add_cacheinfo failed to refresh for path' when merging at a project containing a submodule

Viewed 5660

I have a project with a submodule. When trying to merge a branch (named release) into master, git identified some conflicts and raised the following error:

Fast-forwarding submodule path/to/submodule
Auto-merging path/to/submodule
error: add_cacheinfo failed to refresh for path 'path/to/submodule'; merge aborting.

It completely stopped the merge, as no evidence of it is shown with git status, although I can see some files from the branch release. If I run git merge --abort it also complains with:

fatal: There is no merge to abort (MERGE_HEAD missing).
1 Answers

First I had to reset my branch master with:

git reset --hard origin/master

and delete any files that stayed from the aborted merge (files that came from the release).

After, I updated the submodule to the latest version in both branches, with:

git submodule update --recursive --remote

After that I was able to run the merge without further problems with add_cacheinfo.

Related