From 5a95a015e865a97b38c1ab85da394df4f14f20c7 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Fri, 6 Dec 2024 12:03:58 +0000 Subject: [PATCH] Update roles/home/scripts/commits.sh --- roles/home/scripts/commits.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/roles/home/scripts/commits.sh b/roles/home/scripts/commits.sh index 9f05665..2ff26cc 100644 --- a/roles/home/scripts/commits.sh +++ b/roles/home/scripts/commits.sh @@ -48,17 +48,16 @@ create_pr_from_files() { echo Our: "${files[@]}" echo All: "${all_files[@]}" + + git checkout -b "$temp_branch" || handle_error "Failed to create temporary branch" + git commit -am "Backup changes" || handle_error "Failed to commit changes to temporary branch" + # Switch to base branch and create temporary branch if [ "$current_branch" != "$base_branch" ]; then git checkout "$base_branch" || handle_error "Failed to checkout base branch" git pull || handle_error "Failed to sync base branch" fi - git checkout -b "$temp_branch" || handle_error "Failed to create temporary branch" - git commit -am "Backup changes" || handle_error "Failed to commit changes to temporary branch" - - # Create PR branch from base branch - git checkout "$base_branch" || handle_error "Failed to checkout base branch" git checkout -b "$pr_branch" || handle_error "Failed to create PR branch" # Restore specified files from temporary branch