我在 PC 上安装了 Linux Mint,然后从 Bitbucket 克隆了 git 存储库以在其上运行。经过一些更改后,我确实在我的 PhpStorm ide 中提交了。在此提交期间,git 向我发送了一个关于行尾的对话框。有两种选择。如果我记得的话
创建处理项目行尾的 gitattribute 文件
通过类似 core.autocrlf true 的命令为行尾设置全局处理程序
我选择了全局选项,但正如我所见,它使所有项目文件都发生了变化。现在我不确定会发生什么以及是否可以将其推送到服务器。如果有人在 Windows 上 pull 它会怎样?会 merge 吗?如何解决?
最佳答案
core.autocrlf
Setting this variable to "true" is almost the same as setting the text attribute to "auto" on all files except that text files are not guaranteed to be normalized: files that contain CRLF in the repository will not be touched. Use this setting if you want to have CRLF line endings in your working directory even though the repository does not have normalized line endings. This variable can be set to input, in which case no output conversion is performed.
将 core.autocrlf
设置为 true
意味着 git 将有条件地将工作目录中的行尾转换为 CRLF
和 LF
在您的存储库中。
请参阅: What's the best CRLF (carriage return, line feed) handling strategy with Git?
关于linux - 多操作系统环境中的 Git 行尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38192899/