Considering this commit:
https://github.com/tribbloid/spookystuff/commit/08650c3565a823fb1a696afd7f1461681293a1fe
If I run the following command:
peng@pop-os:~/git/spookystuff$ cat .gitmodules
[submodule "parent/showcase"]
path = parent/showcase
url = https://github.com/tribbloid/spookystuff-showcasepeng@pop-os:~/git/spookystuff$ git submodule sync
peng@pop-os:~/git/spookystuff$ git submodule update --init --remote --recursive
peng@pop-os:~/git/spookystuff$ git submodule status
peng@pop-os:~/git/spookystuff$ git submodule foreach git pull --rebase
peng@pop-os:~/git/spookystuff$ git submodule status
It can be seen that the number of submodule is still 0, contrary to the .gitmodule file
How did this happen? And what can be done to fix it?
In this commit,
.gitmodulesis changed to indicate that the submodulespookystuff-showcaseshould be cloned at pathparent/showcaseinstead ofspookystuff-showcase. But, the actual submodule object is removed: https://github.com/tribbloid/spookystuff/commit/08650c3565a823fb1a696afd7f1461681293a1fe#diff-8f1d364786f7b7fb36c0cd2e5b73810d4d1b435acfc890dad6da02ac7bf95101.This is why all
git submodulesubcommands do nothing: there is no submodule object at that commit in your repository.If the intention was to move the submodule, then ideally
git mv spookystuff-showcase parent/showcasewould have been used.To fix it, you should restore the changes to
spookystuff-showcaseand then properly move it: