I have the following git repositories
VectorRandomStringString relies on Vector, and adds it as a submodule. Vector submodules Random. Random has no dependencies.
Module: RandomModule: Vector
Submodule: RandomModule: String
Submodule: Vector
Submodule: RandomWhen I change something inside of Random submodule inside of Vector, (NOT the actual module Random), it does not automatically update Module: Random or the other Submodule Random's that exist elsewhere.
When I change something inside of Vector (the module), it does not update the Vector in String. If I visit the repository for String, and type git pull, it claims everything is up to date. If I cd inside of submodule Vector and type git pull, only THEN does it actually update my submodule Vector. Ontop of that it wants me to commit changes to the String repository, even though nothing has changed inside of String.
What if I have a repository with 50 submodules? My submodules are going to be changing constantly and I don't want to have to not only pull every single time I want to touch my project but also commit that pull since it was the submodules that changed. There's got to be an easier way to do this.
As mentioned in git pull options, you should use, from String (the main parent repo) a:
git pull --recurse-submodules=yes
git submodule update --recursive
On top of that it wants me to commit changes to the
Stringrepository, even though nothing has changed inside ofString.
Sure something has changed: the gitlink (special entry in the repo index) of the submodule Vector.
If you don't want to do that every time you have to refresh the content of String, and just want to do a simple regular git pull, do only once:
git config --global fetch.recurseSubmodules true
And you can automate the submodule update as a post-checkout hook.
Similarly, a simple git push from String would also push any changed submodule, provided you set once:
git config --global push.recurseSubmodules true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With