When I want to get git diff files, I found someone use
git diff-index --cached --diff-filter=AM --name-only HEAD
and if I use
git diff --cached --diff-filter=AM --name-only HEAD
can get the same result.
So what's the difference between git diff and git diff-index?
When you must use git diff-index but not git diff?