Is monorepo bothering you?

June 21, 2021

Is monorepo bothering you?

What's your problem?

Feeling overwhelmed by your monorepo? Too many scripts, too many projects, too many libraries and intricate dependencies hidden in a myriad of hard to decouple files/modules/packages? You're likely not to be alone..

The solution (the eureka moment)

The mono2repo python script allows to dis-entangle a mono repo in smaller separate sub-projects living in separate git repos.

Here's an example trying to extract the pelican summary plugin from the pelican plugins repo https://github.com/getpelican/pelican-plugins.git:

# generate a new stand alone git tree pelican-summary out of the 
# pelican git repo including all changes in the summary subdir only
$> mono2repo.py init pelican-summary \
   https://github.com/getpelican/pelican-plugins.git/summary

Under pelican-summary "migrate" branch there are all the changes, to merge into the "master" branch:

$> cd pelican-summary
$> git branch
  master
* migrate

# switch to your working master branch and merge from upstream
$> git checkout master
$> git merge migrate

To update the "migrate" branch with the latest upstream changes:

$> mono2repo.py update \
   pelican-summary

That's about it!

Return to blog