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

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

    Ran into the exact same problem.

    • Add the new file that you created using git add filename1.c
    • Make another change in some other filename2.c that was already a part of the repository tracking system.
    • Do a git diff and you will only see the change to filename2.c show up. Changes to filename1.c will not show up.
    • However if you do a git status you will see the changes in both filename1.c and filename2.c show up.
    • Do a git commit -a -m "Changes to filename1.c and filename2.c blah blah"
    • Do a git push

    You will see that filename1.c got committed.

提交回复
热议问题