Live data from Hacker News

I Hate Git Submodules

abildskov.io

11–20 of 73 posts

Re: I Hate Git Submodules

#11
post #7

Also hate them. Far better to have a dependency pulling shell script - no overhead of git yak shaving - just maintaining the URIs.

If you can wrap your build in Nix, I highly recommend it. The upcoming "flakes" feature handles pinning Git-hosted dependencies and locking revisions, even if they aren't Nix flakes themselves.

Re: I Hate Git Submodules

#12
I've been the git fixer for a few different teams. I want to like submodules, but there's something that doesn't fit my brain the way the rest of git does. It feels half-baked. I think we're still missing the best way to model the problem as a tree of related states.

Re: I Hate Git Submodules

#13
post #5

What do people think of git subtrees? https://codewinsarguments.co/2016/05/01/git-submodules-vs-gi... Or the non-standard git-subrepo? https://github.com/ingydotnet/git-subrepo

I came here to recommend subtrees. They're pretty good.

I guess my concern about subtrees is that they seem like they can result in unnecessary duplication / use of disk space. But the ability to work offline with a complete copy of the code seems worth the tradeoff in most cases, and git-lfs should help deal with large file sizes.

Have you run into any "slow push speeds" with subtrees, as the person complains about in the first article I linked?

Re: I Hate Git Submodules

#15
About the point of it not being obvious where you're working: I find using zsh or another shell that prints git information as part of the shell prompt helps immensely with this.

Re: I Hate Git Submodules

#16

What do people think of git subtrees? https://codewinsarguments.co/2016/05/01/git-submodules-vs-gi... Or the non-standard git-subrepo? https://github.com/ingydotnet/git-subrepo

+1 for subrepo.

My concern with subrepo is that I have no idea who is developing it and how much resources they have. I'd hate to learn to use a tool central to my development workflow and then have it discontinued.

Is git-subrepo good enough that it's worth the risk of using something not built into git (and the hassle of installing something extra)?

Re: I Hate Git Submodules

#17
They are a pain but they come in handy for us.

The main thing I learned is if you mess up any part of your submodule during creation - do not try to fix it. Just delete it from the parent repo and start over.

Also do not bother deleting it using git commands. Delete it in the .gitmodules file, then search your .git folder for every reference of the repo you want to delete (including folders named after it) and delete everything.

Either that or start with a clean parent repo clone.

Re: I Hate Git Submodules

#18
post #5

Earlier quoted context omitted.

I came here to recommend subtrees. They're pretty good.

I guess my concern about subtrees is that they seem like they can result in unnecessary duplication / use of disk space. But the ability to work offline with a complete copy of the code seems worth the tradeoff in most cases, and git-lfs should help deal with large file sizes. Have you run into any "slow push speeds" with subtrees, as the person complains about in the first article I linked?

No, I haven't run into any such issue, though I have only used it with small to medium sized repositories. The repo simply grows linearly with the size of the secondary repository. With a submodule, you would have to clone it just the same. In fact, you might enjoy some benefits from cross-compression by using subtrees that would not be available to submodules, and it's faster to reuse the same clone connection you were already getting the source from.

Re: I Hate Git Submodules

#19
At least it is better than subtrees, which cannot tell you what they are even if you ask. Also, ClearCase isn't atomic beyond file level even... you use labels to make "versions".

Re: I Hate Git Submodules

#20
This post is really hard to read. It mentions git submodules and then sharply veers into a bunch of seemingly barely-related paragraphs. If each section had one sentence at the top saying something about git submodules it would be a lot more coherent.
Post reply on HN