title: git hook to create staging branch
body: <p>I am hosting my code on Bitbucket. The webhooks are not adequate to solve my issue, so I am hoping git hooks will work. Since I don't imagine they will work server-side, the git hook should be propagated to each checkout on each developers machine. (I know this might be an issue since its normally a local file, but I can hopefully solve it using information from <a href="https://stackoverflow.com/q/427207/1561176">here</a>)</p>
  
  <p><strong>I want to create a git hook that will push changes to staging branches.</strong></p>
  
  <p>Meaning, if I am a user named <code>bob</code> and I want to push to <code>production/master</code>, instead of it pushing to the <code>production/master</code> branch it will push to a staging branch like <code>staging/master/bob</code>. Same for another user <code>roy</code> who pushes to <code>production/master</code> it will go to <code>staging/master/roy</code>. And the same for any production branch. So <code>edd</code> pushing to <code>production/2.0</code> would push to <code>staging/2.0/edd</code>.</p>
  
  <p>I have tried the pre-commit hook, but I can't find a way to direct the target of the push. I know this is possible.</p>
  
  <p>I tried using <code>GIT_WORK_TREE</code>, and I couldn't seem to get it to work.</p>
  
  <hr>
  
  <p><strong>Clarification</strong></p>
  
  <p>The whole process should be seamless for <code>bob</code> the developer. He should pull from the master and push to the master. (or whatever branch he is working on) and the process will happen in the background. It will push his changes to a staging branch, which will then undergo a CI process, and if successful will be pushed into the main branch. This is the solution that I need.</p>