新的 git clone 显示更改的文件

Posted

技术标签:

【中文标题】新的 git clone 显示更改的文件【英文标题】:Fresh git clone showing changed files 【发布时间】:2015-01-30 19:07:40 【问题描述】:

我正在克隆一个 git 存储库,并且正在查找已更改的文件。我查看了其他一些有类似问题的帖子,但到目前为止,这些步骤似乎没有帮助。我已经尝试调整 autocrlf 设置、案例设置和其他一些配置,但是当我执行“git status”时,我仍然看到修改过的文件。

.git/config 核心部分的配置是:

repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = false
precomposeunicode = true
autocrlf = false

显示为已修改路径的截断示例是:

modified:   applications/test/Dictionary/Make/files
modified:   applications/test/Dictionary/Make/options
modified:   applications/test/Dictionary/Test-Dictionary.C
modified:   src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.H
modified:   src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.H
modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C
modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H
modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C
modified:   src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C

显示为未跟踪的截断路径示例是:

applications/test/Dictionary/Test-dictionary.C
applications/test/Dictionary/testDict
applications/test/Dictionary/testDict2
applications/test/Dictionary/testDictInc
applications/test/Dictionary/testDictRegex
applications/test/Dictionary/value
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrix.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrix.H
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixATmul.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixOperations.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixPreconditioner.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixSmoother.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixSolver.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixTemplates.C
src/OpenFOAM/matrices/LduMatrix/LduMatrix/lduMatrixUpdateMatrixInterfaces.C

每次配置更改后我都做了以下操作:

rm -rf *
git reset --hard 
git status

Git 存储库是 git://github.com/OpenFOAM/OpenFOAM-2.3.x.git,当前操作系统是 MacOS X 10.9.5。 Git 版本是 1.9.3。文件系统是 HFS+(不区分大小写)。

【问题讨论】:

【参考方案1】:

原来存储库中的文件以大写和小写形式存在,位于同一目录中。例如“字典”和“字典”。 MacOS X 端的解决方案是创建一个区分大小写的 HFS+ 磁盘映像,挂载它,然后在挂载路径中签出存储库。

使用的命令:

hdiutil create -size 1g -fs "Case-sensitive Journaled HFS+" -volname "OpenFOAM Development" openfoam-development.dmg

避免引起问题的问题可能会更好,但我只需要接受这个限制。

【讨论】:

【参考方案2】:

当你做一个差异时,你看到任何实际的变化吗?我之前在克隆具有 UNIX 行结尾的存储库并且我在 Windows 上时看到过这种情况,因此它会自动将它们转换为 Windows。

【讨论】:

我确实看到了变化。我在差异工具中选择了“忽略空格”,但仍然看到变化。我难住了。其他存储库没有这个问题。我什至尝试了一个新的克隆,只是为了确定。我很想在 Linux VM 上进行测试,但如果可以的话,我宁愿避免花时间创建。 我尝试克隆并从 Windows 收到相同的问题。我以前从未见过这种情况。 我能够找到一些东西,我在 Windows 8 上,发现更改中有 2 个文件丢失。 JohnsonJacksonParticleThetaFvPatchScalarField.C 和 JohnsonJacksonParticleThetaFvPatchScalarField.H 当我尝试手动创建这些文件时,我无法创建这些文件,因为 Windows 不允许我输入 JohnsonJacksonParticleThetaFvPatchScalarField,因此似乎存在文件名限制。 Windows 似乎有 260 个文件路径限制,并且由于这些文件嵌套非常深,git 遇到问题并且无法正确设置这些文件,这就是我们看到更改的原因因为我们没有最新的。

以上是关于新的 git clone 显示更改的文件的主要内容,如果未能解决你的问题,请参考以下文章

让 git status 显示未修改/未更改的跟踪文件?

Git-hub问题:显示我的laravel项目更改了87个文件

git clone 更改文件修改时间

git status 没有显示我更改的文件

Git删除状态显示更改

实用 Git 示例(git 状态不显示未跟踪/更改的文件)