1

I have these two git commands

git diff-index --cached --name-status HEAD

and

git diff --cached --name-status

I can't see the difference between them. I've been experimenting with adding and modifying and deleting files on my branch and running these commands but they seem to be giving me the same results.

1 Answer 1

1

Since you don't specify paths to git diff or git diff-index, both will by default compare:

  • HEAD (if you don't specify it, it is the tree-ish used by default)
  • and the index (because of the --cached, which does not consider the on-disk file at all)

So it seems normal they return the same result.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.