Update roles/home/scripts/commits.sh

This commit is contained in:
Giulio De Pasquale 2024-12-06 12:03:58 +00:00
parent 5ebc68ad80
commit 5a95a015e8

View File

@ -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