Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

git submodules have ruined my life on multiple teams enough to never want them. They're good enough for a dev team of 2-3 but don't scale very well. git subtree can be a bit better. But ultimately you probably want a working package manager.


Using git subtree for dependencies is completely unworkable for two interrelated reasons:

(1) There's no recursive option; each dependency has to be pulled/pushed/etc. manually.

(2) Each manual pull/push/etc. of a subtree has to be explicitly path-specified and remote-specified.

There's just no easy way to `git subtree pull --prefix=specificdependencysubdir https://github.com/whatever/gadgets main --squash` for each of your dependencies, and each of their dependencies, etc. It's a tedious manual process for everything.

Best case scenario, you make a .PHONY target of `updatesubtrees` and manually keep it up to date with the directory structure and remote URLs of each dependency.


I've heard this often.

Why don't they scale? I used them for some years for a team of ten or so people who all first had to learn to understand how they worked so might that be the problem?


It’s just annoying? Especially if you have access to everything, at one point just having a monorepo makes git “actually work”.


The configuration of ssh vs https can break a lot of workflows, the inability to (reliably) track a branch from a submodule can make maintenance a pain, I've never really figured out how to reasonably do a rebase in the presence of gitmodules changes on both branches, github actions had broken support for submodules for quite awhile... just to name a few.

There's not one giant issue with submodules. There are dozens of small annoyances and footguns. I have yet to see a problem that is better solved by git submodules that can't be solved another way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: