I learned on WordCampPhilly-2015 about gh-pages (thanks to Sal), it is a nice github feature to host/showcase static pages.
Static pages in GitHub repo as a URL. Branch “gh-pages” + empty file .nojekyll, push to GitHub. #wcphilly Example http://t.co/WFzI4YFjUm
— Sal Ferrarello (@salcode) June 14, 2015
So I was just trying to incorporate this on my workflow, but after few commits I felt this is a messy approach to keep switching between master and gh-pages branches and keeping them in sync, hence I googled and of course found a better way to automate it–
Just add following two lines to [remote “origin”] section of your local .git/config file:-
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
After this, you can keep working on your master branch, but then everytime you will push – that will automatically trigger the further push/sync to gh-pages.