The somewhat counterintuitive issue here (or at least it was for me is this): If the newest version of your main repository gets out-of-sync with your submodule, then when you try and "update" the submodule by running git submodule update
from within the main repository, it will only pull up to the latest changes SPECIFIED IN THE PARENT, and not in the submodule.
In other words, your parent project could be pointing to the wrong commit of your submodule. To ensure that your parent is pointing to the latest submodule commit (which is my case what I wanted), navigate into the submodule and run git pull
and then return to the parent and run git add .
Next, if you run the git diff
command you'll notice that although none of the files have changed in the main repository, you'll get a dirty
message showing you that the submodule now points to a new commit. That's what you want. Just commit the changes and push them up, and your two projects should be re-synchronized.
Make sure that in the future, if you make changes to the submodule, that you also add them to the parent repository using git add .
(you'll notice a dirty
message when the submodule changes).