'git status' shows changed files, but 'git diff' doesn't

前端 未结 15 1915
轻奢々
轻奢々 2020-12-12 11:37

I\'ve had a look at all similar questions. However, I\'ve double checked and something strange is definitely happening.

On one server (Solaris with Git 1.8.1) I clon

15条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 12:11

    As already noted in a previous answer, this situation may arise due to line-ending problems (CR/LF vs. LF). I solved this problem (under Git version 2.22.0) with this command:

    git add --renormalize .
    

    According to the manual:

           --renormalize
               Apply the "clean" process freshly to all tracked files to
               forcibly add them again to the index. This is useful after
               changing core.autocrlf configuration or the text attribute in
               order to correct files added with wrong CRLF/LF line endings.
               This option implies -u.
    

提交回复
热议问题