Skip to content

Commit

Permalink
exists
Browse files Browse the repository at this point in the history
  • Loading branch information
valiantlynx committed Sep 18, 2024
1 parent 5314179 commit 9e354c5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
# Define the name of the new branch
NEW_BRANCH="new-branch8"

echo "Branch $NEW_BRANCH already exists, checking it out and resetting it."
git checkout $NEW_BRANCH
# Check if the branch already exists
if git rev-parse --verify $NEW_BRANCH >/dev/null 2>&1; then
echo "Branch $NEW_BRANCH already exists, checking it out and resetting it."
git checkout $NEW_BRANCH
else
# Create and switch to the new branch
echo "Creating new branch $NEW_BRANCH."
git checkout -b $NEW_BRANCH
fi

git reset --hard HEAD
find . -mindepth 1 -not -path "./build*" -not -path "./.git*" -not -name ".env" -exec rm -rf {} + 2>/dev/null \
&& (mv build/* build/.* . 2>/dev/null || true) \
Expand Down

0 comments on commit 9e354c5

Please sign in to comment.