It takes careful preparation and execution to divide a mono repo into smaller repositories in order to preserve code history, dependencies, and team procedures. The steps are as follows:
Describe the Scope:
- Identify modules or services in the mono repo that can function as independent repositories.
- Document dependencies and interactions between these modules.
Preserve Commit History:
- Use tools like git filter-repo or git subtree to extract specific directories or modules into separate repositories while preserving their commit history.
Set Up New Repositories:
- Create new repositories on your preferred VCS platform (e.g., GitHub, GitLab).
- Push the filtered history to these repositories.
Update Dependencies:
- Replace local references to modules with references to the new repositories.
- Use package managers (e.g., npm, Maven) for dependency management if applicable.
Update CI/CD Pipelines:
- For every new repository, migrate or duplicate the current CI/CD workflows.
- Make sure the tests and builds for the divided repositories operate separately.
Share Modifications:
- Update the team's instructions, train them on the new workflows, and let them know about the changes.
Observe and Improve:
- After the migration, keep an eye out for difficulties and take care of any integration or dependency concerns.
Advance your career with a Post Graduate Program in DevOps—master CI/CD, Kubernetes, and cloud automation with hands-on projects and expert mentorship!