After setting up your gh-pages branch according to a short howto from chrisjacob just add this little post-commit hook and everytime you commit something now the documentation of your elixir project is being generated by ex_doc from your current master branch.
First put this into a file called
git checkout master
git checkout gh-pages
git add .
git commit -m "update documentation"
git push origin gh-pages
After that make sure it's executable by using
chmod +x <your_project>/.git/hooks/post-commit
and now you're ready to go.