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

前端 未结 4 1919
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 16:16

 Why is that git diff thinks there are no changes

..even if git status reports them as modified?

$ git status
On bra         


        
4条回答
  •  花落未央
    2021-02-01 17:13

    git diff diffs against the index, not against your HEAD revision. By running git add, you've put the changes in your index, so of course there are no differences! Use

    • git diff HEAD to see the differences between your tree state and the HEAD revision, or
    • git diff --cached to see the differences between your index and the HEAD revision.

提交回复
热议问题