I know this question has been asked before, but I found all answers to just give me a quick solution to the problem, or a confusing explanation of why it happens and how it is actually solved.
This is how i encountered this error. One of my teammates pushed a change to a submodule in our repo. After pulling from master git status
showed new commits in our submodule:
modified: path/to/submodule/submodule_name (new commits)
So i decided to update the submodule by running
git submodule update path/to/submodule/submodule_name
-- here is the doc for this command
at this point i got the error
Fetched in submodule path 'path/to/submodule/submodule_name', but it did not contain ... Direct fetching of that commit failed
After googling i found different answers to my problem:
superuser is the link that got me closer to understanding the issue, and github just handed me the command to run to fix it -- git submodule sync
Now, i am still a bit confused on how the change showed up in my git status
yet when i try to update the server is not aware of the commit. And what does git submodule sync
do to make that commit available ?