1

I have a repo with 8 submodules, all of which have been working smoothly for some time now.

The other day I ran git status on one of the submodules, and it was showing me status and commit history of the parent repo.

I noticed the parent repo no longer had a .gitmodules file, so I manually created that, and the error appeared to be resolved. The commit history and status were showing correctly for submodules.

The issue now is that the submodules are somehow not fully linked to the parent repo. Here are some symptoms:

  • When making code changes to both, and pushing the parent to a web server, the submodule changes do not get pushed to the server.
  • When inside the parent repo on Gitlab, the submodule folder is normally clickable, linking to the submodule repo, however, it is no longer clickable.

I attempted a "de-init" and "re-init" of all submodules however it did not resolve the issue. Here's that code:

# unbinds all submodules
git submodule deinit -f .
# checkout again
git submodule update --init --recursive

My hosting provider is stumped, and so am I.

scoreytime
  • 46
  • 4

1 Answers1

0

I was able to resolve the issue using the steps below as informed by the solution in this post.

  • Used the git commands below to reset the parent repo and all submodules to their working state prior to the breakage. (note: the hash will match the commit you'd like to reset to)
git reset --hard f414f31
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at f414f31"
  • Restored the original .gitmodules file that previously went missing. (This, I believe, was a key component to the solution)
Dharman
  • 30,962
  • 25
  • 85
  • 135
scoreytime
  • 46
  • 4