I did this for a while myself with a shell script.
Solution 1.
Create a .gitignore that excludes the _site/ folder. Then have your shell script check whether you are on master, if so, add all changed files and commit them. Then move the _site/ folder to a temporary folder. Switch to the gh-pages branch and copy the temporary folder over. Add all and commit. Push both master & gh-pages branch.
Solution 2.
Copy the contents of the _site/ folder to another repo that is an exact clone of the repo you are working with but checked out on the gh-pages branch. Then simply push the master branch from the source repo and the gh-pages branch from the other repo