HACKER Q&A
📣 msadowski

Best way to source control multiple repos building upon each other


Hi HN!

I'm working on an online course that currently has four chapters. The students need to be able to start the project from any chapters they want.

Ideally, I should be able to provide partial/full solutions as a repository (or an archive) to students. So far, I've separated the work into two directories per chapter (one for the full solution, one for the partial).

The problem is - if I want to modify something in any place and want to keep it consistent, I need to make a change in 8 directories.

I've been thinking about the best way to organize it but can't think of any approach that would be simple and would allow me to change the code in a single place.

I was thinking about submodules, but the projects are not clear-cut, sometimes the same files will be modified in multiple chapters.

I would hugely appreciate any thoughts you might have!


  👤 dave4420 Accepted Answer ✓
Write a script that builds the repo from scratch. (Perhaps by applying diffs against the previous directory.)

Then you just need to update an rerun the scripts (or one of the files/diffs it depends on.)

Keep this script and its helper files in a separate repo.