title: What's the difference between git diff and gif diff-index
body: <p>When I want to get git diff files, I found someone use </p>
  
  <pre><code>git diff-index --cached  --diff-filter=AM --name-only  HEAD
  </code></pre>
  
  <p>and if I use </p>
  
  <pre><code>git diff --cached --diff-filter=AM --name-only  HEAD 
  </code></pre>
  
  <p>can get the same result.
  So what's the difference between <code>git diff</code> and <code>git diff-index</code>?
  When you must use <code>git diff-index</code> but not <code>git diff</code>?</p>