Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git pull error: "fatal: cannot rebase with locally recorded submodule modifications"

Tags:

git

I'm getting this error doing a git pull:

fatal: cannot rebase with locally recorded submodule modifications

Googling for this error message essentially no results! That was a first for me.

You can see this error in the git source control here (to verify it is a real error), https://github.com/git/git/blob/master/builtin/pull.c#L961

I tried deleting all the submodules in the project, re-init'ing them, etc and nothing will let me do a git pull on the master branch.

like image 624
Aidan Avatar asked Jan 16 '19 11:01

Aidan


1 Answers

Obviously you've set your git pull to run git rebase. When you do this and have enabled submodule recursion, git pull checks to see if there are submodule changes within in range of commits that will be rebased, and refuses to run if so.

You can simply break this up into separate git fetch, git rebase and git submodule update commands. Rebase has no submodule recursion option and hence is not concerned here. Or, you could run git pull --no-recurse-submodules to tell git pull not to look at any submodules.

I tried deleting all the submodules in the project ...

You would have to delete the submodules from every commit in the range of commits to be rebased, which would replace all those commits with new ones that have no submodules. Since you're likely to replace them all with the rebase anyway, that's not that terrible, but it's also not very nice to yourself—it will make you have to go restore them to every commit in the rebased results.

like image 140
torek Avatar answered Oct 06 '22 19:10

torek