linux - 多操作系统环境中的 Git 行尾

标签 linux windows git line-endings

我在 PC 上安装了 Linux Mint,然后从 Bitbucket 克隆了 git 存储库以在其上运行。经过一些更改后,我确实在我的 PhpStorm ide 中提交了。在此提交期间,git 向我发送了一个关于行尾的对话框。有两种选择。如果我记得的话

  1. 创建处理项目行尾的 gitattribute 文件

  2. 通过类似 core.autocrlf true 的命令为行尾设置全局处理程序

我选择了全局选项,但正如我所见,它使所有项目文件都发生了变化。现在我不确定会发生什么以及是否可以将其推送到服务器。如果有人在 Windows 上 pull 它会怎样?会 merge 吗?如何解决?

最佳答案

根据 git-config Documentation :

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/

相关文章:

linux - 在Linux中计算多个csv文件中的行和文本字符串并通过管道传输到csv文件

C 如何为 MPI 程序创建 Makefile?

git - 如何将开发分支 merge 到master中并忽略master中的更改?

python - Django 检查服务器是否已经运行

windows - 如何在 Windows 上设置 PhoneGap

git - 如何在 GIT 中显示最后 N 个标签

git - `git stash show` 的输出为空

php - Apache2.4.11 虚拟主机配置不工作

linux - 内核 panic ——copy_from_user、kmalloc 失败?

C 控制台输出不连续,等待程序完成