migrate-to-monorepo
· One min read
Instructions to migrate agent repos to mono repo
export AGENT_NAME=foo
- Clone the Target Monorepo (ai-platform-engineering)
cd /tmp
git clone git@github.com:cnoe-io/ai-platform-engineering.git
- Clone agent-$AGENT_NAME to a temp location:
cd /tmp
git clone git@github.com:cnoe-io/agent-$AGENT_NAME.git agent-$AGENT_NAME-temp
cd agent-$AGENT_NAME-temp
- Rewrite history to move everything into ai_platform_engineering/agents/$AGENT_NAME:
git filter-repo --to-subdirectory-filter ai_platform_engineering/agents/$AGENT_NAME
- Now add this rewritten repo as a remote to your monorepo:
cd ../ai-platform-engineering # Go back to your main repo
git remote add $AGENT_NAME-temp ../agent-$AGENT_NAME-temp
git fetch $AGENT_NAME-temp
- Create a branch
git checkout -b migrate_agent_$AGENT_NAME
- Merge the imported history (use --allow-unrelated-histories the first time):
git merge $AGENT_NAME-temp/main --allow-unrelated-histories
- Clean Up (Optional)
git remote remove $AGENT_NAME-temp
read -p "Delete ../agent-$AGENT_NAME-temp and all contents? [y/N] " ans && [[ $ans =~ ^[Yy]$ ]] && rm -rf ../agent-$AGENT_NAME-temp
- Upload branch and PR
git push origin migrate_agent_$AGENT_NAME