git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "First empty commit"
git checkout main
rm -rf public
git worktree add public gh-pages
# Remove all existing files in public folder
rm -rf public/*
# Generate Hugo site
hugo
# Go into worktree subdirectory of branch gh-pages
cd public
# Deploy Hugo site
git add --all
# Commit all changes to branch gh-pages
commit_msg="Update site on $(date '+%b %d, %Y')"
git commit -m "$commit_msg"
# Push to branch gh-pages
git push origin gh-pages
Settings - Pages - Branch - gh-pages - / (root) - Save