title: Git pre-commit hook : changed/added files
body: <p>I am writing a pre-commit hook. I want to run <code>php -l</code> against all files with .php extension. However I am stuck.</p>
  
  <p>I need to obtain a list of new/changed files that are staged. deleted files should be excluded.</p>
  
  <p>I have tried using <code>git diff</code> and <code>git ls-files</code>, but I think I need a hand here.</p>