Files
eve-industrializer/updateRemote.sh
2025-07-09 16:53:28 +02:00

64 lines
1.5 KiB
Bash

#!/bin/bash
# Function to check if work tree is clean
check_work_tree_clean() {
if ! git diff-index --quiet HEAD --; then
echo "Error: Work tree is not clean. Please commit or stash your changes first."
exit 1
fi
}
# Function to process a single branch
process_branch() {
local branch_name=$1
echo "Processing branch: $branch_name"
# Check out the branch
if ! git checkout "$branch_name"; then
echo "Error: Failed to checkout branch $branch_name"
exit 1
fi
# Check out main -- src
if ! git checkout main -- src; then
echo "Error: Failed to checkout main -- src"
exit 1
fi
# Add all changes
if ! git add .; then
echo "Error: Failed to add changes"
exit 1
fi
# Commit changes
if ! git commit -m "Update"; then
echo "Error: Failed to commit changes"
exit 1
fi
# Push to remote
if ! git push "$branch_name" "$branch_name:main"; then
echo "Error: Failed to push to remote"
exit 1
fi
echo "Successfully processed branch: $branch_name"
}
# Main script
echo "Starting update process..."
# Check if work tree is clean
check_work_tree_clean
echo "Work tree is clean, proceeding..."
# Process branches kosmodiskclassic1 through kosmodiskclassic5
for i in {1..5}; do
branch_name="kosmodiskclassic$i"
process_branch "$branch_name"
done
git checkout main
echo "All branches processed successfully!"