Why does git diff-index HEAD result change for touched files after git diff or git status? : <p>If I <code>touch</code> a file tracked in a git repo, and run <code>git diff-index HEAD</code>, it will print output with <code>M</code> indicating the file has been modified. For example,</p>

<pre><code>$ touch foo
$ git diff-index HEAD
:100644 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0000000000000000000000000000000000000000 M  foo
</code></pre>

<p>I am unsure if this makes sense or not, but that is not the question. The question is, why does the output change (to no diff) if I run <code>git diff HEAD</code> or <code>git status</code>?</p>

<pre><code>$ touch foo
$ git diff-index HEAD
:100644 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0000000000000000000000000000000000000000 M  foo
$ git diff                  # no output
$ git diff-index HEAD       # no output
</code></pre>

<p>I would expect the result, whatever it is, to stay the same across commands that are not supposed to change anything.</p>
