A git submodule is always pinned to a particular commit -- this is just how submodules work -- and that commit is recorded in the parent repository. This is to ensure some level of sanity -- if multiple people clone the parent repository, they will all get the same version of the submodule even if there have been additional commits in the submodule repository.
If you want to update the submodule commit, you need to first update the submodule:
cd submodule
git checkout master
git pull
And then record the new commit in the parent repository:
cd ..
git commit -m 'updated submodule' submodule
If you want to see the commit to which a submodule is pinned, just run git submodule
, which will return output like this:
773d95e1dce80acea254465e896394a2eb158336 _posts (heads/posts)
94a6903384ca271b7e6ff74443ac2eddaf1d1da4 assets (heads/assets)
The first field is the commit id. You can also see this with git ls-tree
; for a submodule in the top level of your repository:
git ls-tree master: | grep <directory_name>
For a submodule not in the top level:
git ls-tree master:path/to/parent | grep <directory_name>
This should show the same information as git submodule
.