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
#!/bin/bash git checkout master mix docs cd docs/ 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.