I’ve been using Github Pages a lot recently and it’s awesome ! It provides you a quick and powerful way to host a demo of your work. But one thing that I found annoying using
gh-pages is that it suggests you to have a totally different empty branch with your demo in it and then to switch to that branch everytime you want to update your demo page, make your changes, commit to
gh-pages and then push the whole thing to github. I found this a bit tedious.
But with this quick tip you can just work directly on master, make a demo page in it (aka
index.html), commit and push as usual and then type the followings command :
I’m sure it will seem obvious to a lot of you, but I’m not a git expert and before I discovered this way of doing Github Pages, I was struggling keeping
gh-pages branch up to date.
If you have a better way to do so, feel free to let me know.
*Edit : * Github has now a feature (in the repository settings) that let’s you choose the branch on which your github page site is (see below). So you may not need this from now on.