title: Can This Review-Based Git Workflow Be Enforced by Gerrit?
body: <p>Is there a tool, that makes pull-requests and combined reviews fool-proof and safe in git?</p>
  
  <p>I know that there are a couple of related questions, that have already been asked at github (See also: <a href="https://stackoverflow.com/questions/5319390/using-git-for-code-reviews">Using git for Code Reviews</a>, <a href="https://stackoverflow.com/questions/2285206/online-code-review-tool-with-git-integration">Online Code Review Tool with Git Integration</a>).</p>
  
  <p>People have been suggesting the use of <a href="http://code.google.com/p/gerrit/" rel="nofollow noreferrer">gerrit</a> or <a href="https://gist.github.com/" rel="nofollow noreferrer">gist</a>.</p>
  
  <p>Solutions presented in previous questions have nice interfaces, however they fail horribly when it comes to access control. Our company is too small to force a single person reviewing the code or to have dedicated maintainers. Therefore we are looking for a tool to ensure (or at least encourage) that code is reviewed before it gets pushed to our central repository.</p>
  
  <p><strong>Note</strong>: Absolute user access control is not necessary, because we generally trust our employees. However we want to prohibit a push directly to our central repository without restricting the privilege to push to a single person.</p>
  
  <p>Thus the tool (or combination of tools and scripts) should achieve at least these tasks:</p>
  
  <ul>
  <li>make pull requests visible in a web interface. (gerrit achieves that)</li>
  <li>the central repository is linked to that tool, such that read-only access is possible, but pushing requires at least another person to review and acknowledge the changeset. </li>
  <li>the person responsible for review and acknowledgement can be an arbitrary person from the development team.</li>
  <li>the tool must autonomously detect (and refuse) pull requests that lead to merge conflicts.</li>
  <li>it shouldn't use git functions that are known to alter the SHA1 hash of the commit(s).</li>
  </ul>
  
  <p>My proposal to this solution:</p>
  
  <ul>
  <li>use gerrit for pull-requests and review handling.</li>
  <li>gerrit should always have a clone of the master.</li>
  <li>for every pull request gerrit checks whether the patches are applicable to master without conflicts (that would be a script hook, and I don't know whether gerrit features them).</li>
  <li>the central repository is owned by a privileged user with shell access (here named <code>gerrit</code>) and is exposed via http(s).</li>
  <li>whenever another person reviews the code, there is an apply button in the web interface that will automatically push the changes to the central repository. </li>
  </ul>
  
  <p>Unfortunately I don't know gerrit and documentation is scarce. Is it possible to implement this workflow in gerrit? Is there perhaps another tool, that fulfils these requirements?</p>