Skip to content

🌱 Create a monorepo by merging multiple github repositories

License

Notifications You must be signed in to change notification settings

ksindi/monoreaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 

Repository files navigation

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

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:

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:

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.

About

🌱 Create a monorepo by merging multiple github repositories

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages