Huang Rong@DESKTOP-O2VRRQO MINGW64 ~/Documents/git/testgit (master)
$ git add test.txt
warning: LF will be replaced by CRLF in test.txt.
The file will have its original line endings in your working directory
出現warning: LF will be replaced by CRLF是換行符的原因,解決辦法很簡單,一行代碼,如下配置:
$ git config --global core.autocrlf false
我們再來add一條操作試試
Huang Rong@DESKTOP-O2VRRQO MINGW64 ~/Documents/git/testgit (master)
$ touch demo.txt
Huang Rong@DESKTOP-O2VRRQO MINGW64 ~/Documents/git/testgit (master)
$ git add demo.txt
完美~