I have a project A which is a library and it is used in a project B.
Both projects A and B have a separate repository on github BUT inside B we have a submodule of A
Single line version
git submodule foreach "(git checkout master; git pull; cd ..; git add '$path'; git commit -m 'Submodule Sync')"