11

phpstorm设置换行兼容Windows(CRLF)和Linux(LF)

 2 years ago
source link: https://blog.csdn.net/weixin_44000238/article/details/108399817
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

phpstorm设置换行兼容Windows(CRLF)和Linux(LF)

于现在大多数项目都是运行在 Linux 服务器上,很多PHP开发使用的是WINDOWS系统,最终导致在Windows上克隆的代码,提交到git上后,换行符都换成CRLF 了,在Linux平台上克隆下来也是 CRLF换行符…然后就裂开了

PHPStorm编辑器修改换行符

@version 2020PHPStorm配置截图

Setting配置路径

Git配置

Git命令行修改AutoCRLF

提交时转换为 LF,检出时转换为CRLF(推荐windows)
git config --global core.autocrlf true
提交时转换为LF,检出时不转换(推荐*unix/mac)
git config --global core.autocrlf input
提交检出均不转换
git config --global core.autocrlf false

Git命令行修改SafeCRLF

拒绝提交包含混合换行符的文件
git config --global core.safecrlf true
允许提交包含混合换行符的文件
git config --global core.safecrlf false
提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn

本文参考文献:phpstorm设置换行兼容Windows(CRLF)和Linux(LF)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK