why `git diff` reports no file change after `git add`

Please try git diff --staged command.

Alternative options available are listed below.

git diff

shows changes between index/staging and working files. Since, in your case, git add moved your files-with-changes to staging area, there were no modifications shown/seen.

git diff --staged

shows changes between HEAD and index/staging. git diff --cached also does the same thing. staged and cached can be used interchangeably.

git diff HEAD

shows changes between HEAD and working files

git diff $commit $commit

shows changes between 2 commits

git diff origin

shows diff between HEAD & remote/origin

Leave a Comment