Skip to content

Instantly share code, notes, and snippets.

@rakshithxaloori
Created February 12, 2025 06:59
Show Gist options
  • Save rakshithxaloori/bca971b652017a1a10006cef8b768e8c to your computer and use it in GitHub Desktop.
Save rakshithxaloori/bca971b652017a1a10006cef8b768e8c to your computer and use it in GitHub Desktop.
A script to merge multiple repos into a mono repo
cd merged-repo
git remote add api-repo <source-url>
git fetch api-repo
git checkout -b api-branch api-repo/main
mkdir api
find . -mindepth 1 -maxdepth 1 ! -name 'api' ! -name '.git' -exec git mv {} api/ \;
git commit -m "Move api repository contents to 'api' folder"
git checkout main
git merge --allow-unrelated-histories api-branch
# git push origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment