-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
33 lines (26 loc) · 998 Bytes
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# This script does the required work to set up your personal GitHub Pages
# repository for deployment using Hugo. Run this script only once -- when the
# setup has been done, run the `deploy.sh` script to deploy changes and update
# your website. See
# https://hjdskes.github.io/blog/update-deploying-hugo-on-personal-github-pages/
# for more information.
# Name of the branch containing the Hugo source files.
SOURCE=sources
msg() {
printf "\033[1;32m :: %s\n\033[0m" "$1"
}
msg "Adding the \`public\` folder to .gitignore"
echo "public" >> .gitignore
msg "Deleting the \`master\` branch"
git branch -D master
git push origin --delete master
msg "Creating an empty, orphaned \`master\` branch"
git checkout --orphan master
git reset --hard
git commit --allow-empty -m "Initial commit on master branch"
git push origin master
git checkout $SOURCE
msg "Adding the master branch into the \`public\` folder"
rm -rf public
git worktree add -B master public origin/master