remp script
This commit is contained in:
59
scripts/cleanup-repo.sh
Normal file
59
scripts/cleanup-repo.sh
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# Cleanup Remote Repository - Remove Architecture-Level Files
|
||||
# =============================================================================
|
||||
# This script removes files from git tracking that shouldn't be in the repo
|
||||
# Files are removed from git but kept locally (needed for builds)
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧹 Cleaning up repository..."
|
||||
echo ""
|
||||
|
||||
# Remove frontend node_modules from git
|
||||
echo "📦 Removing frontend/node_modules/ from git tracking..."
|
||||
git rm -r --cached frontend/node_modules/ 2>/dev/null || echo " (already removed or not tracked)"
|
||||
|
||||
# Remove frontend dist from git
|
||||
echo "📦 Removing frontend/dist/ from git tracking..."
|
||||
git rm -r --cached frontend/dist/ 2>/dev/null || echo " (already removed or not tracked)"
|
||||
|
||||
# Remove all __pycache__ directories from git
|
||||
echo "🐍 Removing Python __pycache__/ directories from git tracking..."
|
||||
git ls-files | grep "__pycache__" | xargs -r git rm --cached 2>/dev/null || echo " (already removed or not tracked)"
|
||||
|
||||
# Remove .vite cache if tracked
|
||||
echo "⚡ Removing .vite/ cache from git tracking..."
|
||||
git rm -r --cached frontend/.vite/ 2>/dev/null || echo " (not tracked)"
|
||||
git ls-files | grep "\.vite" | xargs -r git rm --cached 2>/dev/null || echo " (already removed)"
|
||||
|
||||
# Remove any .pyc files
|
||||
echo "🐍 Removing .pyc files from git tracking..."
|
||||
git ls-files | grep "\.pyc$" | xargs -r git rm --cached 2>/dev/null || echo " (already removed)"
|
||||
|
||||
# Remove any .pyo files
|
||||
echo "🐍 Removing .pyo files from git tracking..."
|
||||
git ls-files | grep "\.pyo$" | xargs -r git rm --cached 2>/dev/null || echo " (already removed)"
|
||||
|
||||
# Remove any .env files (shouldn't be in repo)
|
||||
echo "🔐 Removing .env files from git tracking..."
|
||||
git ls-files | grep "\.env$" | xargs -r git rm --cached 2>/dev/null || echo " (not tracked)"
|
||||
|
||||
# Remove log files
|
||||
echo "📝 Removing log files from git tracking..."
|
||||
git ls-files | grep "\.log$" | xargs -r git rm --cached 2>/dev/null || echo " (not tracked)"
|
||||
|
||||
echo ""
|
||||
echo "✅ Cleanup complete!"
|
||||
echo ""
|
||||
echo "📊 Summary of changes:"
|
||||
git status --short | head -20
|
||||
echo ""
|
||||
echo "💡 Next steps:"
|
||||
echo " 1. Review the changes: git status"
|
||||
echo " 2. Commit the cleanup: git commit -m 'chore: remove architecture-level files from repo'"
|
||||
echo " 3. Push to remote: git push"
|
||||
echo ""
|
||||
echo "⚠️ Note: Files are removed from git but kept locally (needed for builds)"
|
||||
|
||||
Reference in New Issue
Block a user