Skip to content

Instantly share code, notes, and snippets.

View JalilArfaoui's full-sized avatar
👨‍💻

Jalil Arfaoui JalilArfaoui

👨‍💻
View GitHub Profile
@JalilArfaoui
JalilArfaoui / merge-to-monorepo.md
Created February 5, 2024 23:35
Merge multiple git repos with history into one monorepo

1️⃣ Create an empty git repository named « Monorepo ».

2️⃣ For each existing "project_x" repository, move all files and folders (except .git) into a target path in the new monorepo, and then :

git commit -m "move all project_x files into /project-x"
git remote add monorepo MONOREPO_URL
git fetch monorepo
git merge monorepo/main --allow-unrelated-histories -m "merge project_x into monorepo"
git push mono