This question Is there a way to make git pull automatically update submodules? has an accepted answer of configuring git like so:
git config --global submodule.recurse true
Like one of the comments to that answer, I'm wondering why this isn't the default behavior of git; more precisely, what are the drawbacks of setting this configuration option?
If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
In the context of the ignore = dirty setting for submodules, this means that if the submodule is dirty (i.e. if it has tracked files with modifications that have not been committed, and/or new untracked files), such changes will be ignored.
Submodules are very static and only track specific commits. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated. When adding a submodule to a repository a new . gitmodules file will be created.
I have two reasons why lately I reverted to back to recurse=false
:
recurse=false
seems to have mitigated it, but again: I didn't investigate the problem fully.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