Today I Learned

A collection of useful bits & bobs I'd rather not forget
Deploy a subfolder as a GitHub pages site

Static sites on github must be deployed to the gh-pages branch. Sometimes you may want to deploy a sub folder within your repository to be at the root of your site. For example:

-- / 
---- build/ << contains built site
---- source/
---- README.md
---- etc..

You can deploy the /build/ folder from the master branch to the root of gh-pages using the subtree command:

git subtree push --prefix build origin gh-pages

As a bonus, if you're using a custom domain you need to ensure there's a CNAME file in the root of the /build/ folder with the domain name in it. You can wrap this up in a shell command like so:

touch build/CNAME
echo \"domainname.co\" >> build/CNAME
GITHUB
Things I learned on other days →