Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3df7953

Browse files
Delete local branch if already existing
1 parent 1ed4352 commit 3df7953

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

build/docs-prep.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ fi
9292
print_success "Pulled latest changes from origin/gh-pages"
9393

9494
# Step 4: Create a new branch for the update
95+
print_info "Checking if branch ${NEW_BRANCH} exists and deleting it if it does…"
96+
if git show-ref --verify --quiet refs/heads/${NEW_BRANCH}; then
97+
execute "git branch -D ${NEW_BRANCH}"
98+
else
99+
print_info "Branch ${NEW_BRANCH} does not exist, proceeding with creation…"
100+
fi
95101
print_info "Creating new branch ${NEW_BRANCH}"
96102
execute "git checkout -b ${NEW_BRANCH}"
97103

0 commit comments

Comments
 (0)