Git post-commit hook to keep master and gh-pages branch in sync

In your Git repository create a file .git/hooks/post-commit and fill it with this:

#!/bin/sh
git checkout gh-pages
git rebase master
git checkout master

After that every commit that you do on the master branch will immediately also be applied to the gh-pages branch. When pushing to Github simply use git push --all instead of git push origin master.