[READ-ONLY] Build and maintain monorepo (monolithic repository) like a boss
Clone or download
Tomáš Votruba
Tomáš Votruba Merge pull request #1 from TomasVotruba/patch-1
README: add deprecated note
Latest commit a1a5ce6 Feb 20, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin add estimate clear Feb 6, 2018
src add Error note Feb 13, 2018
tests fix PropertyNameMatchingTypeFixer for mixed Feb 13, 2018
.gitattributes [Monorepo] init Jan 28, 2018
.gitignore [Monorepo] init Jan 28, 2018
.travis.yml improve bin testing Feb 1, 2018
LICENSE [Monorepo] init Jan 28, 2018
README.md README: add deprecated note Feb 20, 2018
composer.json drop spatie/async, causing more error than help Feb 2, 2018
phpunit.xml phpunit: fix autoload path Jan 30, 2018


Deprecated - use shopsys/monorepo-tools instead

Monorepo - Build and Maintain Monorepo like a Boss

Build Status Downloads Subscribe


1. Build Monolithic Repository from Many Repositories

  • Do you have many packages with long git history?
  • Do you want to turn them into monorepo?
  • Do you want keep their history?

That's exactly what build command does.

Directories to work With

You're working with 2 directories:

  • monorepo directory - monorepo will be created there, it must be empty

  • build directory - where you have symplify/monorepo installed, e.g.

    composer require symplify/monorepo

Do all following steps in build directory.

3 Steps to Build Monorepo

  1. Create monorepo.yml with build section
        # remote git repository => directory in monorepo to place the package to
        'git@github.com:shopsys/product-feed-zbozi.git': 'packages/ProductFeedZbozi'
        'git@github.com:shopsys/product-feed-heureka.git': 'packages/ProductFeedHeureka'
  1. Run build command with monorepo directory as argument

Remember, it must be outside this directory and must be empty.

vendor/bin/monorepo build ../new-monorepo
  1. A new /new-monorepo directory is created, with git history for all the packages

2. Split Monolithic Repository to Many Repositories

  1. Create monorepo.yml with split section
        directory in monorepo with package => remote git repository
        'packages/ProductFeedZbozi': 'git@github.com:shopsys/product-feed-zbozi.git'
        'packages/ProductFeedHeureka': 'git@github.com:shopsys/product-feed-heureka.git'
  1. Run split command
vendor/bin/monorepo split

It splits current working directory, but you can use argument to change that:

vendor/bin/monorepo split ../new-monorepo

Your last tag and master branch is now published in the repository.

Other Features

Is Your Config in Other Location?

vendor/bin/monorepo split --config second-monorepo.yml

Rules of Monorepo

  • Only committed files and directories can be split.
  • It takes time to move commit history of big projects (build command), e.g. for 7000 commits in 2500 files roughly 3 hours. Running script overnight is recommended.

Built With Help Of