My aggregated monorepo of OCaml code, automaintained

Monorepo Development Guide#

This is a monorepo managed by monopam. Each subdirectory is a git subtree from a separate upstream repository.

Making Changes#

  1. Edit code in any subdirectory as normal
  2. Build and test: opam exec -- dune build and opam exec -- dune test
  3. Commit your changes to this monorepo with git

Exporting Changes to Upstream#

After committing changes here, they must be exported to the individual repositories before they can be pushed upstream:

monopam push

This extracts your commits into the individual checkouts in ../src/. You then review and push each one manually:

cd ../src/<repo-name>
git log --oneline -5        # review the changes
git push origin main        # push to upstream

Pulling Updates from Upstream#

To fetch the latest changes from all upstream repositories:

monopam pull

This updates both the checkouts and merges changes into this monorepo.

Important Notes#

  • Always commit before push: monopam push only exports committed changes
  • Check status first: Run monopam status to see which repos have changes
  • One repo per directory: Each subdirectory maps to exactly one git remote
  • Shared repos: Multiple opam packages may live in the same subdirectory if they share an upstream repository

Troubleshooting#

If monopam push fails with "dirty state", you have uncommitted changes. Commit or stash them first.

If merge conflicts occur during monopam pull, resolve them in this monorepo, commit, then the next pull will succeed.