I have built a site locally with Jekyll, and have pushed it to a new master repo (username.github.com) and the site works great yay. My question is, how do I move just the deployable part, the _site directory, into a gh-pages branch? Or rather, the contents of that directory if that is the best way to deploy?
I plan on using a custom domain. My workflow will be to work in the master branch, maybe some feature branches, and then push (merge) the compiled outcome into the gh-pages branch. Does that sound correct?
I am having a tough time figuring it out via documentation, would appreciate any help, thank you!
Your workflow does not sound correct based on the details in your question.
If you have pushed your Jekyll-based site to a username.github.io
repository, then you do not need a gh-pages
branch. A gh-pages
branch is only required for repositories where you want to have code and a website in the same repository. GitHub Pages will take care of running Jekyll for you and serving the compiled site in both cases.
GitHub Pages does run Jekyll in a very specific manner in order to keep it safe. If you're using custom plugins with your Jekyll site, then you'll need to store your compiled site (the _site
directory you mentioned) on the master branch, and the source in a different branch.
To summarize, your workflow should be work in your local repository - either in the master
branch or feature branches (merging the feature branches to your local master
branch as needed) - and when you're ready to publish, push your local repository to the master
branch on GitHub.