Somewhere in the course of committing and pushing code individually in my submodules, the root repo suddenly thinks that code in my submodule is actually part of the root repo; that is, files that are part of the submodule are now appearing as unstaged files to be added in the root repo. I verified this by running git status
.
It's almost as if git forgot there are such things as submodules and thinks I added all these files. I did notice that the submodule has a .git
file not a .git
directory. In the file has this line
gitdir: ../.git/modules/root-repo
and the root repo has a .git/modules/sub-repo
folder as expected.
How do I get back to the correct state?
I suppose I can clone the root repo again and recursively update the submodules, but that seems heavy handed.