Configuring publishing sources for GitHub Pages

~1 min read 1 comment

You know what sucks? Maintaining two separate branches of an open source project, just to host its source code and documentation together with GitHub Pages.

For example, my Jekyll theme’s are setup on GitHub with the following branches:

Anytime I push updates to master I switch to the gh-pages branch, cherry pick commits, and deal with any conflicts. Wouldn’t it be nice if there was a better way to keep everything together in a single branch?

Well there is. Under Settings there is a drop-down menu under GitHub Pages/Source that allows you to choose where to build from1.

GitHub Pages Sources
GitHub Pages settings.

Flip the source to master branch /docs folder, move contents of gh-pages into /docs on master, and boom :tada:!

Source code and documentation in a single branch. No more switching branches and “:cherries: cherry picking” for me :thumbsup:.

  1. You can configure GitHub Pages to publish your site’s source files from master, gh-pages, or a /docs folder on your master branch for Project Pages and other Pages sites that meet certain criteria. 

Enjoyed this content?

Help keep it free by sending a donation or purchasing something from my Amazon Wish List. You can also subscribe to various site feeds to get notified of new posts or follow me on social media.

1 comment

Leave a comment

↑ back to top