Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Merged 6 Repos Into One Monorepo With Claude Code Without Breaking CI

Description and use

Six service repositories merged into a monorepo while preserving git history, streamlining CI with path filtering, and deduplicating utilities. Tools: git filter-repo, GitHub Actions, Turborepo, Claude Code.

Problem

Six independent service repos caused duplicated code, version drift, and slow cross‑cutting changes, making maintenance hard and leading to a production incident.

Outcome

Merged six repos into a single monorepo while preserving git history, reduced median CI time from 11 to 7 minutes, achieved a 70% Turborepo cache hit rate, and eliminated duplicated utilities.

Workflow

  • 1. Rewrite each repo’s history to a subdirectory with git filter‑repo and merge into monorepo using --allow-unrelated-histories.
  • 2. Verify merge integrity with blame survival, commit count, and tree diff checks.
  • 3. Consolidate CI: generate a unified workflow with path filtering driven by Turborepo’s dependency graph, ensuring only affected packages run.
  • 4. Deduplicate utilities: inventory all copies, identify equivalent ones, promote them to packages/shared-utils, rewrite imports, and leave divergent copies with explanatory comments.
  • 5. Set a hard cutover date, archive old repos, and enforce the new monorepo workflow.

Evidence

The merge itself was the easy part. The real work was CI and the shared code — and an AI agent turned out to be great at one of those and dangerous at the other.

Source

I had Claude Code write a script that did this for all six repos and then verify the result — and the verification is the part I'd tell you to steal.

Source

The fix is path-filtered jobs driven by Turborepo's dependency graph.

Source

  • Record date: 2026-09-10T08:18:54.820Z