Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ksindi/monoreaper
:seedling: Create a monorepo by merging multiple github repositories
https://github.com/ksindi/monoreaper
bash github monorepo utility
Last synced: about 1 month ago
JSON representation
:seedling: Create a monorepo by merging multiple github repositories
- Host: GitHub
- URL: https://github.com/ksindi/monoreaper
- Owner: ksindi
- License: mit
- Created: 2017-04-09T22:20:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T01:23:06.000Z (7 months ago)
- Last Synced: 2024-06-02T02:42:49.896Z (7 months ago)
- Topics: bash, github, monorepo, utility
- Language: Shell
- Homepage:
- Size: 25.4 KB
- Stars: 29
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MonoReaper
Merge multiple GitHub repositories into a monorepo while preserving commit history. Each repo will live as a subdirectory. **Currently only works in Linux**.
Features:
- Merge multiple repos while keeping full history and commit hashes.
- Specify branches of each repo to merge.
- Migrate repos into existing monorepo.Requirements:
- git version 2.9+.## Usage
```bash
export MONOREPO_NAME=monorepo # defaults to monorepo
git clone [email protected]:ksindi/monoreaper.git && cd monoreaper/
chmod +x monoreaper.sh
bash monoreaper.sh owner/repo0 owner/repo1
# you can specify another default branch via `owner/repo0/some-branch`.
```The above script will create a `monorepo` directory with a README.md file and subdirectores `repo0` and `repo1`. Note only the default branches of each repo will be included.
If you now want to add the monorepo to GitHub:
```bash
cd monorepo/
git remote add origin [email protected]:owner/monorepo
git push -f origin master
```### Merging with existing monorepos
If you already have a monorepo and want to merge other repos into it,
all you have to do is include a `MONOREPO_DIR` env variable:```bash
MONOREPO_DIR=path/to/my/monorepo bash monoreaper.sh owner/repo0 owner/repo1
```Note that the `MONOREPO_DIR` must have `master` as default branch.
## Why monorepos?
- Streamlines ops logic. The overhead of setting up pipelines and deployments is cumbersome.
- Shared codebase introduces shared ownership, naming and style.
- Dependencies across services are easier to manage.
- Searching code across multiple repos is a hassle.
- Lots of great tools that take advantage of monorepos. See [awesome-monorepo](https://github.com/korfuri/awesome-monorepo).