What is the difference between running
git submodule update --remote vs
cd <submodule directoy> git pull Assuming that the submodule was previously set to track some branch:
git submodule add -b master [URL to Git repo]
For example, submodule update --remote --merge will merge upstream submodule changes into the submodules, while submodule update --merge will merge superproject gitlink changes into the submodules.
With Git 2.34, if the repository is cloned with the --recurse-submodules , a simple git pull will recurse into submodules.
Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .
The difference is:
git pull will only update your submodule branch, but it can be any branch that you could have checked out yourself in that submodule repo.git submodule update --remote will only update the branch registered in the .gitmodule, and by default, you will end up with a detached HEAD, unless --rebase or --merge is specified or the key submodule.$name.update is set to rebase, merge or none.In both cases, you still have to go back to the parent repo, add and commit the new submodule SHA1 reference.
That is because in both instances, the SHA1 of the submodule changes, which means the gitlink (special entry in the index of the parent repo, named after to root folder of the submodule) must be added and committed.
A git submodule update --init --remote is like:
git submodule init: to initialize (checkout) the submodules recorded in the indexgit submodule update --remote: to pull from the registered branch (or master by default), once the submodule has been initialized (checked out).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