I want to share with you how I deploy some websites with GitHub Service Hooks. I original found out about this method from Jeffrey Way with his article The Perfect Workflow, with Git, GitHub, and SSH.
The other day I needed to deploy to domain.com and dev.domain.com from the same repo. I must of Googled and tried a bunch of results for about 6 hours and came up empty handed and frustrated. I ended up calling John Britton, a close friend of mine that works for GitHub.
I was surprised when I found out how simple it was. I had the answer the whole time, it is exactly what Jeffrey taught us. All you have to do is fire the following when your Service Hook (WebHook URL) is called.
Try to think about your server as a co-worker. Let say you are working on master and your co-worker (the server) is working on the dev branch. If you are making changes and push to master and your co-worker pulls while on dev, of course they won't get your master changes. If you are working on and push to master and your co-worker is working on master and pulls, they will receive those changes. So naturally the when git pull get called it will only pull from what ever branch it is on.
I made a little video to better explain my work flow and how this all works.
If you have any questions please feel free to ask.