#!/bin/bash # Branch Consolidation Script # Consolidates all Dependabot branches into main echo -e "\033[0;32mStarting branch consolidation...\033[0m" # Fetch latest from remote echo -e "\033[0;33mFetching latest from remote...\033[0m" git fetch origin # Get current branch CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo -e "Current branch: \033[0;36m$CURRENT_BRANCH\033[0m" # Ensure we're on main if [ "$CURRENT_BRANCH" != "main" ]; then echo -e "\033[0;33mSwitching to main branch...\033[0m" git checkout main fi # Get all Dependabot branches DEPENDABOT_BRANCHES=$(git branch -r --list "origin/dependabot/*" | sed 's/^[[:space:]]*//') echo -e "\n\033[0;36mFound Dependabot branches:\033[0m" echo "$DEPENDABOT_BRANCHES" | while read -r branch; do if [ -n "$branch" ]; then echo -e " - $branch" fi done echo -e "\n\033[0;33mNote: Dependabot branches should be merged via GitHub PRs\033[0m" echo -e "\033[0;33mThis script prepares the consolidation plan.\033[0m" # Create summary BRANCH_COUNT=$(echo "$DEPENDABOT_BRANCHES" | grep -c "dependabot" || echo "0") SUMMARY="# Branch Consolidation Summary ## Dependabot Branches Found $BRANCH_COUNT branches ## Next Steps 1. Review Dependabot PRs on GitHub 2. Test each dependency update 3. Merge approved PRs 4. Clean up merged branches " echo -e "\n$SUMMARY" echo -e "\n\033[0;32mConsolidation plan created!\033[0m"