6 ms·
Show HN: Get rid of Git submodules and never look back (now for GitHub users)
- w4rh4wk5 4y agoUnrelated: What ever video player they are using, it sucks. I am viewing the video on a 21:9 screen in full screen and content is cut off since the player fills out the whole screen instead of keeping the video centered with black bars.
- sigio 4y agoAt least there's a download-link with the video, playing it back locally show's its also scaled.
- vadishev 4y agoProbably depends on a video player of your browser, how it scales the video. It's just an mpeg4 video published on the website.
- AndriusK 4y agoIt's just a video element.
- widdershins 4y agoIt also had terrible audio quality for me.
- jaywalk 4y agoIt's because they set "object-fit: cover" on the video element's CSS.
- nyanpasu64 4y agoWhile I'm also eagerly looking for an alternative to Git submodules (an initial pit of failure is that clones and checkouts aren't recursive by default, and in the long run it's annoying that branching/forking a module doesn't fork its submodules' upstreams), and the existing alternatives are poor (subtrees fail to resolve merge conflicts, and subrepos are unmaintained, fragile, and break when you rebase a clone/pull commit), I'm instantly put off by the slick commercialized sales-funnel design of your website.
- hobo_mark 4y agoI know submodules, and I sort of know subtrees (which as I understand are similar to what this tool does, except more manual and error-prone), but what are subrepos? [this]( https://www.mankier.com/1/git-subrepo https://www.mankier.com/1/git-subrepo)?
- nyanpasu64 4y agohttps://github.com/ingydotnet/git-subrepo https://github.com/ingydotnet/git-subrepo. I adopted it a few years back, found that the commands' help text didn't match the actual flags they took, the last repo update was over 1.5 years ago, and they stopped replying to issues as well.
- sshine 4y agogit subrepos are an alternative to git submodules and git subtrees. https://github.com/ingydotnet/git-subrepo https://github.com/ingydotnet/git-subrepo git subrepos work simply by copying your dependency to a subdirectory and committing the changes using one large commit that retains metadata about the update to the subrepo. For that reason, git subrepos aren't symlinks. You don't need to git clone --recursive like with git submodules, and you don't need cross-repo authentication. Updating a subrepo means performing another commit. Even though git subrepos are the most poorly maintained, the design is simpler. I wish someone would fork and take over maintenance. git subrepos are the best.
- vodou 4y agoAre Git submodules really that bad? Really? Maybe it's me that haven't yet discovered their true dark side. They're not perfect, but works well for mid-sized projects at least.
- antonvs 4y agoThey have a reputation for being bad, which is enough for a company like the one in the OP to use as a marketing hook.
- xmorse 4y agoThe most annoying problem is CI, i cannot even use a private git submodule in Github Actions without creating a personal token, passing it to secret and use some git command
- dirkt 4y agoWhich seems more a problem with Github tooling, and less with git submodules.
- Dm_Linov 4y agoThat's because you haven't had all code messed up when someone pushed in the wrong order :-)
- Denvercoder9 4y agoHow can pushing in the wrong order mess up all code? The worst thing I can imagine is pushing the superproject with a subproject update, but not pushing the subproject. That would end up with an unbuildable commit in the superproject, as you can never check out its associated commit from the subproject, but I don't see how that's close to "messing up all code".
- Dm_Linov 4y agohttps://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/ https://codingkilledthecat.wordpress.com/2012/04/28/why-your... - there's a good example here
- abathur 4y agoThis is probably only marginally helpful given how ~monorepo-focused the pitch is, but, if: - you're using submodules to vendor dependencies or develop multiple related projects - you have control over your environments/toolchains You can generally use Nix to compose the projects together from separate source repos. You can have a version-controlled specification of exactly which commits you're depending on and control of when to update them. Fair warning: I'm speaking with the naivety of someone who occasionally needs to build projects that use submodules, and as someone who has been tempted to use submodules for my own inter-related projects (but used Nix to avoid doing so), and not as someone firsthand familiar with other use-cases like working in a bigcorp monorepo :)
- baalimago 4y agoNot sure why the angle is "replace Git submodules". Seems like it's simply a different architecture where the "sub repo" library requires a lot more updates than what a git submodule is designed to handle
- TheBrokenRail 4y agoJust like others, I've never really had a problem with Git submodules apart from forgetting to recursive clone or or twice. So I don't personally see the point of this, epsiecally since the pricing page implies it will cost money once it's out of beta. (On that note, are there any actual reasons to not just --recurse-submodules by default?)
- saxonww 4y ago"Enterprise pricing will be revealed after the full-fledged release."
- Rapzid 4y ago> Submodules done right Click-bait marketing seriously?
- klabb3 4y agoThe basic premise is true, I've heard many wiser-than-me devs nightmare stories about submodules. But I thought the OSS world had largely moved to git subtree, which is completely transparent for people who don't maintain the subtree folder and is supported in git for quite a while. Perhaps not? In either case, I'd love to see a comparison to both git subtree and submodules, on a more "workflow-by-workflow" basis.
- jsmith45 4y agoThis sounds to me a lot like git-subtree combined with automation where commits to the subtree's native repository cause automation to add those commits (with path adjustments) to the super-repo, and vice versa. This keeping both sides always in sync with each other can avoid some of the downsides of git-subtree, but has its own limitations like only working when both sides are owned by the same org, does not allow a subtree that maintains "local patches", etc. If simultaneous pushes to super-repo and child repo occur at the same time, one gets applied and the other gets converted to a pull request (unclear if the server reports error back to the git client, or if the push appears to succeed, but then appears to be force pushed over by the other change, being preserved as a pull request.)
- mojuba 4y agoI don't understand all the negativity in this thread. Submodules can be annoying in that they require special attention and treatment all the time. You need to keep the mental model of your entire project's tree in mind so that you don't screw up or mix up something. The whole thing just feels a bit too fragile. Submodules are usually good for frameworks and libraries that are more stable than your main codebase. However, those submodules under active development within the same organizations can be a pain to maintain. I'm not sure there's a good solution to this under git at all, but at least there's a product that makes an attempt and I absolutely don't mind the commercial intent here. For example GitHub is commercial after all, what's wrong with that?
- 60secz 4y ago> Submodules are usually good for frameworks and libraries that are more stable than your main codebase. However, those submodules under active development within the same organizations can be a pain to maintain. Except they aren't. Libraries are better in their own code base and published as a separate artifact which is auto-versioned.
- 60secz 4y agohttps://abildskov.io/2021/03/28/why-i-hate-submodules/ https://abildskov.io/2021/03/28/why-i-hate-submodules/
- _gabe_ 4y agoFrom the article you linked: > I know some programming ecosystems, such as C++ does not have a default way of handling libraries and dependencies, and in that case it might be good to look into submodules. > Please, if there is any dependency management in your chosen platform use it. I use C++. There is no such thing as package management in C++ (at least no unified standard that you can use with confidence with every library). So giving a blanket statement and saying that you should just ship library artifacts is a non starter in a language like C++. This basically implies either creating a package manager, or distributing binaries manually, or forcing users to find the correct versions manually and install them. Git submodules is extremely helpful here, and if you look at the documentation this is what it sounds like it was created for: > Large projects are often composed of smaller, self-contained modules. For example, an embedded Linux distribution’s source tree would include every piece of software in the distribution with some local modifications; a movie player might need to build against a specific, known-working version of a decompression library; several independent programs might all share the same build scripts.[0] If this suggestion here doesn't sound like your use case, then your probably using the wrong tool. In the same way, you wouldn't tell people who use a hammer to cut a piece of wood in half that the hammer must be a terrible tool. You would say something like, you're using the wrong tool, here's a saw. Use the correct tool for the job at hand. If you need source code from a 3rd party library that you won't modify but you depend on, a submodule is a fine tool for the job. [0]: https://git-scm.com/docs/user-manual#submodules https://git-scm.com/docs/user-manual#submodules
- nrclark 4y agoWhat's the comparison between this and Repo?
- mh- 4y agoI assume the parent comment refers to this, to save others googling "git repo".. https://github.com/GerritCodeReview/git-repo https://github.com/GerritCodeReview/git-repo
- TillE 4y agorepo is Google's tool that they use for at least their public code, and it's also used by a number of other sprawling projects (eg, Couchbase). It's certainly the first tool I would think of when you need to manage a ton of repositories under one project.
- mh- 4y agoFair. In hindsight, I've actually used it. Probably with Chromium and perhaps AOSP earlier. But I didn't recognize the name immediately. Thought I'd add the link for others.
- Klasiaster 4y agoSome aspects of git submodules are bad, especially for beginners. When I used them the first time had the strange experience that checking out or pulling left the submodule out of sync and I had to go to the directory and check out the right reference. Now I've learned to throw --recurse-submodules after "git checkout", "git pull", and "git clone" and you can mostly forget submodules then unless you start to interact with it explicitly.
- surrealize 4y agoI haven't had a chance to try it at scale yet, but I've been looking at josh (Just One Single History): https://github.com/josh-project/josh https://github.com/josh-project/josh which goes at more-or-less the same problem from the other direction. Josh helps with treating a monorepo as separate repos, as opposed to git x-modules' approach of treating separate repos as one repo. Either way, the idea is to try and get the benefits of both monorepo and multi-repo styles, while avoiding/mitigating the disadvantages. HN talked about it 11 months ago: https://news.ycombinator.com/item?id=27844363 https://news.ycombinator.com/item?id=27844363 Anyone have experience/updates to share since then, or a comparison with git x-modules?
- 60secz 4y agoIn every respect, versioned libraries are far superior to submodules. Every time I've encountered submodules in any work projects, I've personally replaced them with auto-incremented semver libraries (usually jars) and received copious thanks for it.
- jayd16 4y agoWhen I see this done, it ends up causing headaches as well. You now have to deal with a second authentication flow that is usually a lot more opaque. I work in games with less technical people such as artists. Bootstrapping their workspace is an effort. "Setup your maven credentials" might as well be ancient latin. Submodules aren't ideal but I do prefer that you can pull down everything you need in a one liner instead of multi-stage pull, build, auth, download, build etc. So I wouldn't say its better in every respect.
- rurban 4y agoIn most aspects submodules are far superior to bad versioning. I understand the Amazon workflow, but never found a company were it worked properly. In my current job, which uses semver and conan and not submodules, submodules would have solved most of the problems. But unfortunately they are all git newbies (switching from svn just lately), so you cannot throw submodules at them yet.
- mal10c 4y agoMy personal setup is: /home/eric/repos/ All git repos end up in that folder - it's basically my project folder. Before explaining more, I should specify that this setup works well for me, but I could see how others may not agree with it. Let's say I have 2 projects called prj1 and prj2. In that case, I would have the following directories: /home/eric/repos/prj1 /home/eric/repos/prj2 Both of those would be git repos. Now, let's say that both of those repos rely on a shared repo, which I'll called shared-repo. In that case, I would have this: /home/eric/repos/shared-repo Then (and here's the part that probably won't sit well with folks), I just reference the parent directory from either prj1 or prj2 to access shared-repo. Down sides: I'm forcing a hard coded directory hierarchy and directory naming. Up side: it's simple. If symlinks worked just as well on Windows as they do on Linux, I could just create a symlink in both prj1 and prj2 that points to my shared-repo directory and that could solve this whole mess too. Having said all that, submodules have worked for me in the past, but I use them so rarely that I always need to look them up - so I've gotten in the habit of keeping things simple for myself and just doing things the way I mentioned above.
- TOGoS 4y agoI've used a similar system, and tried to formalize this approach at work. The directory containing the projects is the "workspace" or "deployment" (depending if you're talking about your dev machine or a server, but same structure), and it contains "projects". Take whatever set of projects at whatever versions they need, check them out to the workspace, maybe set some environment variables (or symlink apache config files) as applicable, and hit the run button. The biggest downsides of this approach that I discovered are that (A) projects are not self-contained, which meant some expert (i.e. me) always had to go and fix the deployments, because nobody else understood the system, and (B) a lot of the frameworks we used had their own system for organizing dependencies, which meant that we'd end up with projects inside projects inside projects anyway, and this system, whose intended purpose was to _flatten_ the directory tree, effectively just added another level to it. Edit: (C), which is a variation of (B): if some projects are in monorepos, that throws off the system, too. Now instead of workspace/project you have workspace/monorepo-project/subproject, so now in some cases you have to reference "../../something" instead of just "../something". Not everything fits into the nice flattened-out system where relative paths are easy to guess, so you end up having to either merge things together with symlinks, which gets confusing because now you have two parallel structures going on, or just configuring dependencies with environment variables after all (at which point you wish you had just formalized the environment variables from the beginning to make everything explicit).
- dang 4y agoRecent and related: Ask HN: Why are Git submodules so bad? - https://news.ycombinator.com/item?id=31792303 https://news.ycombinator.com/item?id=31792303 - June 2022 (167 comments)
- bastardoperator 4y agoI feel like submodules are an extension of SVN externals which are also in my opinion a bad idea. I rather run a mono repo or bring dependencies I need at build time using something like tag versus having to manage submodules.
- helens 4y agoLooking forward for GitLab version!!
- cryptonector 4y agoSynchronizing is not acceptable.
- brnt 4y agoMain thing I wish for is to have a submodule be easier to set to track a (version) tag. Now I have to lookup what the checksum corresponds to. Maybe also I could set their dirs to be 'read only'; git should refuse any local changes and only accept a direct change of checkout (of hash or tag).