3 ms·
I found Git submodules excellent for certain use cases. Here are some real world examples: - I have some software I’ve written that runs on a single board com
by codetrotter 4y ago
I found Git submodules excellent for certain use cases.
Here are some real world examples:
- I have some software I’ve written that runs on a single board computer. Inside of this repository I have a sub module pointing at the commit from which the Linux image is built, that my software runs on. This is extremely useful because if I ever have to rebuild the Linux image there is never any doubt about which version of it that I have been running my software on. So I can rebuild the Linux image from the same commit as before, and then add my software to it. In the future I might also automate more steps and again then I will get even more benefits from this. But already today it is hugely useful for me to have a sub module like this.
- I generated some Rust code for the types of a third-party API that we use. I generated this code from their OpenAPI spec which they have in a git repo. I added their git repo as a sub module in our repo and committed the generated code alongside the sub module pointing at the commit from which the code was generated. Perfect!
Git sub modules are super useful for several things. They can be a bit confusing and frustrating at times. But there are ways like what I mention above where they are perfect to use.
- moffkalast 4y agoI've found that vcstool[0] is the better solution for your first example and have been using it extensively both in personal and company projects without any issues, except on occasion forgetting to commit some subpackage changes as git sometimes doesn't indicate untracked changes correctly. The principle is similar but with explicit repos and branches defined in a config file that can then be pulled or cloned as one. [0] https://github.com/dirk-thomas/vcstool https://github.com/dirk-thomas/vcstool