Enter the submodule directory:
cd projB/projA
Pull the repo from you project A (will not update the git status of your parent, project B):
git pull origin master
Go back to the root directory & check update:
cd ..
git status
If the submodule updated before, it will show something like below:
# Not currently on any branch.
# Changed but not updated:
# (use "git add ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# modified: projB/projA (new commits)
#
Then, commit the update:
git add projB/projA
git commit -m "projA submodule updated"
UPDATE
As @paul pointed out, since git 1.8, we can use
git submodule update --remote --merge
to update the submodule to the latest remote commit. It'll be convenient in most cases.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…