merge-monorepo-tool
v1.2.0
Published
CLI tool to merge multiple repositories into a monorepo while preserving Git history.
Maintainers
Readme
merge-monorepo-tool
CLI tool to merge multiple repositories into a monorepo while preserving Git history.
Features
- Merge multiple Git repositories into a single monorepo
- Preserve full commit history for each project
- Supports custom subdirectory mapping for each repo
- Simple configuration via YAML file (JSON also supported for backward compatibility)
- Fast and safe (uses git-filter-repo)
Installation
You can install globally or use via npx:
npm install -g merge-monorepo-tool
# or
npx merge-monorepo-toolUsage
Initialize configuration
Generate a sample configuration file:
npx merge-monorepo-tool initEdit monorepo-merge-config.yaml to set your repositories and desired subfolders.
Merge repositories
Run the merge process:
npx merge-monorepo-tool mergeConfiguration
The tool uses a YAML config file named monorepo-merge-config.yaml in your working directory (you can also use monorepo-merge-config.yml or keep monorepo-merge-config.json for backward compatibility).
Example:
default_branch: main
repos:
- source: /absolute/path/to/repo1
subdir: apps/backend
branches:
main: main
tags: true
- source: /absolute/path/to/repo2
subdir: apps/frontend
branches:
main: main
tags: truesource: Absolute path to the source repositorysubdir: Subdirectory in the monorepo where the repo will be placedbranches: Mapping of source branch to target branchtags: Whether to preserve tags
Requirements
- git-filter-repo must be installed and available in your PATH.
- Node.js 16+
License
MIT
