Submodules
When you clone a submodule into your repository, it will have its own .git / config file and its own concept of origin. Assuming the submodule is yours (for example, there is no third-party repository above your remote), you do not need to worry about creating an upstream remote for the submodule.
If you need to create an upstream remote for your submodule, it's easy enough. Just cd into the top level directory of your submodule and give it the same way as for the main repository.
cd myForkOfOtherProject git remote add upstream git:
There is no name conflict because the submodule is just a regular git repository with some additional meta information tracked in the superproject. Superproject and submodule do not share .git / config files.
For all purposes and tasks, you process the origin and upstream within the submodule in the same way as for any other repository. The git commands that you run inside the submodule are independent of the superproject, which is mainly interested in tracking the current submodule commit id.
Todd A. Jacobs
source share