title: How to prevent a specific branch from being merged in git?
body: <p>We have a <code>master</code> branch where the released production code lives, a <code>dev</code> branch where the code for the test server lives, and various feature branches (branched from <code>master</code>) as each developer sees fit.</p>
  
  <p>Over the course of time the <code>dev</code> branch has diverged somewhat from <code>master</code>. In addition, there are some incorrect merges there that mess up parts of the code. Several times already we have tried to reset (force-push) <code>dev</code> to be the same as <code>master</code>. To start over with a clean slate, so to say.</p>
  
  <p>Unfortunately this does not last long. Sooner or later someone merges the old <code>dev</code> into the new <code>dev</code>, bringing back all the mess with it. I suspect this might even happen automatically, where a naive <code>git pull</code> silently merges the old and new branch heads.</p>
  
  <p>Is it possible to prevent this with a server-side commit hook? Something that would refuse to accept the <code>git push</code> if the wrong commit is merged in?</p>