Reputation: 668
Say I create a git repo with a submodule in it. Then I clone the repo (with the submodule) and create a branch in my local repo. Will that branch include the submodule? If I change 2 files in the repo, f1 an f2, with f1 in the submodule and f2 outside of the submodule, and then commit my change, will that commit include both files? If I then push the commit, will that change the remote submodule?
Upvotes: 0
Views: 613
Reputation: 12674
Yes it will include the submodule but it will not commit f1 to the submodule's repo.
Think of submodule as a subrepo. It is a separate repository REFERENCED in your current repo. Imagine that many team/repo is referencing/using that repository via submodule too.
Upvotes: 0
Reputation: 3057
cd SubmoduleRepo
git commit --all -m "Change submodule code" // commit changes directly to submodule repo
git push submodule_origin // push changes to remote submodule repo
cd .. // go back to main repository working folder
git add SubmoduleRepo // commit that submodule repo was changed
git commit -m "Updated submodule"
git push origin // push changes for the main repo
Upvotes: 1