http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager-core
core.autocrlf=true
core.fscache=true
core.symlinks=false
core.editor="C:\\Program Files (x86)\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession -noPlugin
pull.rebase=false
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
user.email=***
user.name=***
core.quotepath=false
core.commitgraph=true
core.longpaths=true
receive.advertisepushoptions=true
gc.writecommitgraph=true
credential.helper=manager-core
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
submodul.recurse=true
core.bare=false
core.repositoryformatversion=0
core.filemode=false
core.symlinks=false
core.ignorecase=true
core.logallrefupdates=true
remote.origin.url=***
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
我们从 SVN 切换到 GIT,然后我们将编码从 Windows1252 转换为 UTF8。在这一点上一切看起来都很好,但我还是想提一下。这些更改已成功提交。
git status
和 TortoiseGit 都列出了很多文件(可能是全部)已修改,但这些文件是二进制相同的...git diff
将所有行显示为已删除,将完全相同的行显示为已添加。git diff -w
仅列出非文本文件(jar)。编辑: 我还注意到错误只发生在我们添加 .gitattributes 的提交之后。这包含这样的东西:
*.c text diff=c
*.cpp text diff=cpp
*.hpp text diff=cpp
*.h text diff=c
如果我注释掉这些行,所有修改都将消失。如果我在修改中评论那些行,它们仍然消失了。
在这些尝试之后
git status
和 TortoiseGit 仍然将这些文件列为已修改...为什么所有这些文件都被列为已修改?有没有我缺少的设置?
正如@torek 在评论中指出的那样:.gitattribute 文本设置导致了问题。我们提交了那些 modified 文件,之后一切顺利。
我和我的同事有同样的问题
找到了一个在我的电脑和我的同伴电脑上都能工作的解决方案。
键入以下命令中的第 1 条:
$ git config core.autocrlf false
$ git config core.filemode false
(您可能需要同时输入两个,鉴于您的情况,第一个最合适)
奖励: 如果此解决方案适用于您,并且您想在整个 PC(所有 git 文件夹)上执行此操作,只需在
--global
之后添加参数 git configure
。例如:git config --global core.autocrlf false