Delete local branch if already existing

This commit is contained in:
Julien Déramond 2025-06-12 06:54:12 +02:00
parent 1ed4352db7
commit 3df7953d7a
No known key found for this signature in database
GPG Key ID: EE5F274EA1F477FA
1 changed files with 6 additions and 0 deletions

View File

@ -92,6 +92,12 @@ fi
print_success "Pulled latest changes from origin/gh-pages" print_success "Pulled latest changes from origin/gh-pages"
# Step 4: Create a new branch for the update # Step 4: Create a new branch for the update
print_info "Checking if branch ${NEW_BRANCH} exists and deleting it if it does…"
if git show-ref --verify --quiet refs/heads/${NEW_BRANCH}; then
execute "git branch -D ${NEW_BRANCH}"
else
print_info "Branch ${NEW_BRANCH} does not exist, proceeding with creation…"
fi
print_info "Creating new branch ${NEW_BRANCH}" print_info "Creating new branch ${NEW_BRANCH}"
execute "git checkout -b ${NEW_BRANCH}" execute "git checkout -b ${NEW_BRANCH}"