文件无改动但 IDEA 仍然显示有改动
IDEA Git About 476 words现象
git diff无差异但IDEA仍然显示有改动。
git rollback后能让IDEA显示无改动。
备注
尤其是前端项目。
原因
文件换行符的差别。
Windows:CRLF。
Linux/Unix:LF。
Classic Mac OS:CR。
IDEA
IDEA中会在Show Diff弹窗中显示:Contents have differences only in line separtors。
同时也会显示远程的换行符和本地的换行符。

git config -l
使用如下命令可查看git是否自动转换换行符。
git config -l
输出:autocrlf自动转换为Windows格式。
PS C:> git config -l
...
core.autocrlf=true
...
解决方法
在IDEA底部直接切换对应平台换行符即可。

视频讲解
Views: 5,422 · Posted: 2022-08-22
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...