I have a git repository consist of several git submodules. If I want to update submodules of working repository, it involve:
- cd
- git pull origin master
- cd ..
- git add
- git commit -m “Updated submodule to latest HEAD”
When we pull the submodule updates, “git status” will show modified status for submodule folder. Thus it seems valid to perform git add and commit to make the modified status gone.
Why we need to commit the submodule folder of local working repository as above?
Shall we push the changes to origin after commit?
Imagine if we push the changes, other who pull will need to “git add” and “git commit” again. This seems like an infinite loop around.
If you want to update the submodules, you have to call “git submodule update” (like described here) after “git pull origin master”
Then the repository isn’t any more in dirty state.