-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·45 lines (30 loc) · 1.37 KB
/
init.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
34
35
36
37
38
39
40
41
42
43
44
45
echo "DON'T USE THIS ANYMORE - LEAVING IT TO SHOW THE HEAD F**K THAT GH-PAGES ADDING A CNAME CAUSED!! ARRGGGH"
exit
# Create a new orphand branch (no commit history) named gh-pages
git checkout --orphan gh-pages
# Unstage all files
git rm --cached $(git ls-files)
# Grab one file from the master branch so we can make a commit
git checkout master README.md
# Add and commit that file
git add .
git commit -m "INIT: initial commit on gh-pages branch"
# Push to remote gh-pages branch
git push origin gh-pages
# Return to master branch
git checkout master
# Remove the public folder to make room for the gh-pages subtree
rm -rf public
# Add the gh-pages branch of the repository. It will look like a folder named public
git subtree add --prefix=public git@github.com:guzzlerio/docs.corcel.io.git gh-pages --squash
# Pull down the file we just committed. This helps avoid merge conflicts
git subtree pull --prefix=public git@github.com:guzzlerio/docs.corcel.io.git gh-pages
# Run hugo. Generated site will be placed in public directory (or omit -t ThemeName if you're not using a theme)
hugo -t theme.corcel.io
echo "docs.corcel.io" > public/CNAME
# Add everything
git add -A
# Commit and push to master
git commit -m "Updating site" && git push origin master
# Push the public subtree to the gh-pages branch
git subtree push --prefix=public git@github.com:guzzlerio/docs.corcel.io.git gh-pages