gpt4 book ai didi

c++ - SmartGit (git) 幽灵修改

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:12:53 25 4
gpt4 key购买 nike

我目前在个人项目中使用 smartgit。

我的存储库中有文本 (.txt) + 代码 (C++)。每次我修改我的文本文件并提交它们时,“幽灵”更改会自动出现在我的 .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

关于c++ - SmartGit (git) 幽灵修改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34514602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com