From a241b745999983d10ece0f6956aa04d92a87dec5 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 9 Jul 2025 16:52:56 +0200 Subject: [PATCH] Update remote script --- updateRemote.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 updateRemote.sh diff --git a/updateRemote.sh b/updateRemote.sh new file mode 100644 index 0000000..0d41ae5 --- /dev/null +++ b/updateRemote.sh @@ -0,0 +1,63 @@ +#!/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!"