Github – automate sync between master and gh-pages

I learned on WordCampPhilly-2015 about gh-pages (thanks to Sal), it is a nice github feature to host/showcase static pages.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>