title: How to force a clean git working repository in a makefile?
body: <p>I'm trying to make a <code>deploy</code> command in my Makefile, which simply overwrites to the branch <code>deployment</code> and then pushes this branch to <code>origin</code>.</p>
  
  <p>However, the command must stop/fail with an error message when the working tree is not empty.</p>
  
  <p>Something like the following:</p>
  
  <pre><code>deploy:
  
      status=$(git status --porcelain)
      test "x$(status)" = "x"
      git branch -f deployment
      git push origin deployment
  </code></pre>
  
  <p>Unfortunately, this test on and status variable do not seem to function as wanted.</p>
  
  <p>How would one achieve this? Am I indeed supposed to use <code>test</code>?</p>