SmartGit (git) 幽灵修改
SmartGit (git) ghost modifications
我目前在个人项目中使用 smartgit。
我的存储库中有文本 (.txt) + 代码 (C++)。每次我修改我的文本文件并提交它们时,"ghost" 更改会自动出现在我的 .h 和 .cpp 文件中。
SmartGit 显示修改,但当我检查比较版本时,SmartGit 说两个版本的内容相同。
我想这与我同时使用 Linux 和 Windows 有关,但我找不到解决问题的方法。我在网上查过,但没有找到明确的答案。
这是因为行尾在 Windows (\r\n
) 和 Linux (\n
) 上不同。要修复它,请设置 git 的 core.autocrlf
选项。
来自 Github help page 用于处理此问题:
The git config core.autocrlf
command is used to change how Git handles line endings. It takes a single argument.
On Windows, you simply pass true to the configuration. For example:
git config --global core.autocrlf true
# Configure Git on Windows to properly handle line endings
我目前在个人项目中使用 smartgit。
我的存储库中有文本 (.txt) + 代码 (C++)。每次我修改我的文本文件并提交它们时,"ghost" 更改会自动出现在我的 .h 和 .cpp 文件中。
SmartGit 显示修改,但当我检查比较版本时,SmartGit 说两个版本的内容相同。
我想这与我同时使用 Linux 和 Windows 有关,但我找不到解决问题的方法。我在网上查过,但没有找到明确的答案。
这是因为行尾在 Windows (\r\n
) 和 Linux (\n
) 上不同。要修复它,请设置 git 的 core.autocrlf
选项。
来自 Github help page 用于处理此问题:
The
git config core.autocrlf
command is used to change how Git handles line endings. It takes a single argument.On Windows, you simply pass true to the configuration. For example:
git config --global core.autocrlf true # Configure Git on Windows to properly handle line endings