3 ms·
What is bad about them on the command line? If you understand git the only extra things you need are `git submodule update --init` and `git submodule add ...`
by Xelynega 2y ago
What is bad about them on the command line? If you understand git the only extra things you need are `git submodule update --init` and `git submodule add ...`
- GauntletWizard 2y agoThe UX that sucks is around what happens if they are unclean/how to update them. A checkout doesn't recursively checkout the relevant submodules. This is the biggest pain point for most orgs I've worked at. It's an easy setting to set (`git config --global submodule.recurse true`) but the fact that it's not default hurts. Most engineers have a poor understanding of Git. My university had a great history of version control course right at the dawn of the git era (In 2006! RIT really speedran it, standardizing on Git by the end of the year, but also including tutorials on RCS, CVS, and SVN and a brief foray into Perforce). Still, a ton of my classmates just didn't get it. The other major blocker is what to do with an unclean submodule repo; I honestly don't remember what git does by default, because it's bad. And most projects get unclean real quick. Makefile hygeine is not common, and for most of time most projects became unclean from a simple `make`. It's better now, but not great.
- glandium 2y agoThere are bad interactions with rebase too.
- usr1106 2y agoI have gotten rid of those by the rule: If a commit update updates a submodule, it must not update anything else. (Yes, this can violate the general rule that nothing needs to be added to a commit to be complete. But updating submodules has been worth the exception in my experience.)
- PokestarFan 2y agoI'm working on a project where pushing a commit to a submodule runs a CI job which updates the reference on the parent repository. This seems to lead to very few issues.
- Xelynega 2y ago> Makefile hygeine is not common, and for most of time most projects became unclean from a simple `make`. If you're checking generated files into git, submodules aren't the problem imo. I can see the frustration of modifying submodules files and trying to commit the main repo, but if you have to do that then it wasn't supposed to be a submodule. That's like complaining that modifying node_modules files doesn't apply upstream to your dependencies.
- Izkata 2y agoAdd in "--remote --recursive" to the "update" command and you have the same thing as unpinned svn externals.
- dheera 2y agoI can't remember whether it's git update submodule --init git init --submodules --update git init --recursive --submodule --update etc. Git checkout should do that automatically. Checkout a repo, all the submodules automatically checkout. There is no good reason not to.