Skip to content

Commit

Permalink
new git bash
Browse files Browse the repository at this point in the history
  • Loading branch information
valiantlynx committed Sep 18, 2024
1 parent 4153eb3 commit a83546d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ git checkout -b $NEW_BRANCH
# Exclude the .git directory and .env file from deletion
find . -mindepth 1 -not -path "./build*" -not -path "./.git*" -not -name ".env" -exec rm -rf {} + 2>/dev/null

# Move files and hidden files from the build directory to the current directory
for file in build/.* build/*; do
[ -e "$file" ] && mv "$file" . 2>/dev/null
done

# Remove the build directory if it is empty
rmdir build 2>/dev/null
# Check if the build directory exists and has contents
if [ -d "build" ]; then
echo "Moving contents from build/ folder..."

# Move all files and folders (including hidden files) from build to root
shopt -s dotglob nullglob # Enable globbing for hidden files and prevent errors if build is empty
mv build/* . 2>/dev/null

# Remove build directory if it's empty
rmdir build 2>/dev/null
else
echo "Build directory not found or is empty"
fi

# Add changes to the new branch
git add .
Expand Down

0 comments on commit a83546d

Please sign in to comment.