mirror of
https://github.com/lightbroker/llmsecops-research.git
synced 2026-02-12 14:42:48 +00:00
WIP on phi-3-only: e226420 Merge remote-tracking branch 'origin/auto-generated-20250820-201335-batch-2' into phi-3-only
This commit is contained in:
@@ -1,16 +1,85 @@
|
||||
git fetch --all && git branch -r | grep 'origin/auto-generated-' | sed 's/origin\///' | xargs -I {} sh -c 'git show-ref --verify --quiet refs/heads/{} || git checkout -b {} origin/{}'
|
||||
#!/bin/bash
|
||||
|
||||
# Script to fetch and merge remote auto-generated branches with "batch" in their names
|
||||
# Only processes branches like "auto-generated-YYYYMMDD-HHMMSS-batch-N"
|
||||
# Ignores branches without "batch" in their name
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${BLUE}🔄 Fetching all remote branches...${NC}"
|
||||
git fetch --all
|
||||
|
||||
echo -e "${BLUE}🔍 Finding auto-generated batch branches...${NC}"
|
||||
echo
|
||||
|
||||
# Get all remote branches that match the auto-generated pattern AND contain "batch"
|
||||
batch_branches=$(git branch -r | grep 'origin/auto-generated-' | grep 'batch' | sed 's/origin\///' | sed 's/^ *//')
|
||||
|
||||
if [ -z "$batch_branches" ]; then
|
||||
echo -e "${YELLOW}No auto-generated branches with 'batch' found on remote.${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "📋 Remote batch branches found:"
|
||||
echo "$batch_branches" | while read -r branch; do
|
||||
if [ ! -z "$branch" ]; then
|
||||
echo -e " ${GREEN}✅ $branch${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Show branches that will be ignored (no batch)
|
||||
ignored_branches=$(git branch -r | grep 'origin/auto-generated-' | grep -v 'batch' | sed 's/origin\///' | sed 's/^ *//')
|
||||
if [ ! -z "$ignored_branches" ]; then
|
||||
echo
|
||||
echo "📋 Branches being IGNORED (no 'batch' in name):"
|
||||
echo "$ignored_branches" | while read -r branch; do
|
||||
if [ ! -z "$branch" ]; then
|
||||
echo -e " ${YELLOW}⏭️ $branch${NC}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -e "${BLUE}🌿 Creating local branches for batch branches...${NC}"
|
||||
|
||||
# Create local branches for each batch branch if they don't exist
|
||||
echo "$batch_branches" | while read -r branch; do
|
||||
if [ ! -z "$branch" ]; then
|
||||
if git show-ref --verify --quiet refs/heads/$branch; then
|
||||
echo -e "Local branch ${GREEN}$branch${NC} already exists"
|
||||
else
|
||||
echo -e "Creating local branch ${GREEN}$branch${NC} from ${BLUE}origin/$branch${NC}"
|
||||
git checkout -b "$branch" "origin/$branch"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo -e "${BLUE}🔄 Switching to phi-3-only branch...${NC}"
|
||||
git checkout phi-3-only
|
||||
git pull origin phi-3-only
|
||||
|
||||
# Merge all auto generated branches to dev
|
||||
git branch -r | grep 'origin/auto-generated-' | sed 's/origin\///' | while read branch; do
|
||||
echo "Merging $branch..."
|
||||
git merge origin/$branch
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Merge conflict in $branch"
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
echo -e "${BLUE}🔀 Merging all batch branches into phi-3-only...${NC}"
|
||||
|
||||
# Merge all batch branches
|
||||
echo "$batch_branches" | while read -r branch; do
|
||||
if [ ! -z "$branch" ]; then
|
||||
echo -e "Merging ${GREEN}$branch${NC}..."
|
||||
git merge "origin/$branch"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}❌ Merge conflict in $branch${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}✅ Successfully merged $branch${NC}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
git push origin phi-3-only
|
||||
echo
|
||||
echo -e "${BLUE}⬆️ Pushing phi-3-only to remote...${NC}
|
||||
Reference in New Issue
Block a user