Deprecated - use shopsys/monorepo-tools instead
- 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.
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.
- Create
monorepo.yml
withbuild
section
parameters:
build:
# 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'
- 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
- A new
/new-monorepo
directory is created, with git history for all the packages
/new-monorepo
/packages
/ProductFeedZbozi
/ProductFeedHeureka
- Create
monorepo.yml
withsplit
section
parameters:
split:
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'
- 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.
vendor/bin/monorepo split --config second-monorepo.yml
- 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.
- emiller/git-mv-with-history for
build
command - dflydev/git-subsplit for
split
command