title: How to prevent Git from skipping the pre-commit hook when using git commit -a?
body: <p>We've got this repo for all our Puppet configs. I wrote the following to validate any changed .pp files and bail out of the commit if validation fails. The pre-commit script runs properly when triggered by <code>git commit</code> but <code>git commit -a</code> seems to skip the hook altogether. We use <code>git commit -a</code> exclusively so this behaviour is a bit of a deal breaker. </p>
  
  <p>Am I doing something wrong? Alternatively, what could I do to duplicate git commit -a's behaviour in the pre-commit script?</p>
  
  <pre><code>#!/bin/bash
  # check puppet files for errors before pushing to repo
  for name in `git diff --name-only`; do
      if [[ $name == *.pp ]]; then
          path="$(pwd)/$name"
          puppet parser validate "$path"
          r=$?
          if [ $r -ne 0 ]; then exit 1; fi
      fi
  done
  </code></pre>