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

前端 未结 4 1995
佛祖请我去吃肉
佛祖请我去吃肉 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 16:50

    Because git diff by default checks differences between the staging area and your working copy. When you git add, your staging area matches your working copy and therefore diff reports no changes.

    Adding the --cached flag tells diff to diff against HEAD.

提交回复
热议问题