为什么 git 中此文件夹的名称与其在文件系统中的存在方式不匹配?
Why does the name of this folder in git not match up with how it exists on the filesystem?
我有一个 git 存储库,其中有一个名为 "Sms" 的文件夹,但在过去是 "SMS"。它在每个文件系统中显示为 "Sms",但是当我在其中修改文件时,git status
将其显示为 "SMS",而 PHPStorm 的内置 git 功能不会完全看到变化。
此外,我无法通过 PHPStorm 的 git GUI 查看该目录中任何文件的历史记录。
有什么想法吗?
环境不区分大小写,因此出现此问题。
试一试
"git mv --force SMS Sms"
"Git has a configuration setting that tells it whether to be case sensitive or insensitive: core.ignorecase. To tell Git to be case-senstive, simply set this setting to false"
git config core.ignorecase false
参考:How do I commit case-sensitive only filename changes in Git?
这可能是 windows 的问题,它们不区分大小写。
您可以切换到 linux 或尝试 cygwin 并测试其中的 git。
有些情况下 Git 文件夹的外观与其实际情况不符。
Git 2.23(2019 年第 3 季度)
中对此进行了记录
参见 commit ed33bd8 (24 Jun 2019) by Johannes Schindelin (dscho
)。
(由 Junio C Hamano -- gitster
-- in commit bf8126f 合并,2019 年 7 月 9 日)
t0001: fix on case-insensitive filesystems
On a case-insensitive filesystem, such as HFS+ or NTFS, it is possible that the idea Bash has of the current directory differs in case from what Git thinks it is.
That's totally okay, though, and we should not expect otherwise.
On Windows, for example, when you call:
cd C:\GIT-SDK-64
in a PowerShell and there exists a directory called C:\git-sdk-64
, the
current directory will be reported in all upper-case.
Even in a Bash that you might call from that PowerShell.
Git, however, will have normalized this via GetFinalPathByHandle()
, and the expectation in t0001 that the recorded gitdir
will match what pwd
says will be
violated.
Let's address this by comparing these paths in a case-insensitive manner when core.ignoreCase
is true
.
Reported by Jameson Miller.
我有一个 git 存储库,其中有一个名为 "Sms" 的文件夹,但在过去是 "SMS"。它在每个文件系统中显示为 "Sms",但是当我在其中修改文件时,git status
将其显示为 "SMS",而 PHPStorm 的内置 git 功能不会完全看到变化。
此外,我无法通过 PHPStorm 的 git GUI 查看该目录中任何文件的历史记录。 有什么想法吗?
环境不区分大小写,因此出现此问题。 试一试 "git mv --force SMS Sms"
"Git has a configuration setting that tells it whether to be case sensitive or insensitive: core.ignorecase. To tell Git to be case-senstive, simply set this setting to false"
git config core.ignorecase false
参考:How do I commit case-sensitive only filename changes in Git?
这可能是 windows 的问题,它们不区分大小写。
您可以切换到 linux 或尝试 cygwin 并测试其中的 git。
有些情况下 Git 文件夹的外观与其实际情况不符。
Git 2.23(2019 年第 3 季度)
参见 commit ed33bd8 (24 Jun 2019) by Johannes Schindelin (dscho
)。
(由 Junio C Hamano -- gitster
-- in commit bf8126f 合并,2019 年 7 月 9 日)
t0001: fix on case-insensitive filesystems
On a case-insensitive filesystem, such as HFS+ or NTFS, it is possible that the idea Bash has of the current directory differs in case from what Git thinks it is.
That's totally okay, though, and we should not expect otherwise.On Windows, for example, when you call:
cd C:\GIT-SDK-64
in a PowerShell and there exists a directory called
C:\git-sdk-64
, the current directory will be reported in all upper-case.
Even in a Bash that you might call from that PowerShell.Git, however, will have normalized this via
GetFinalPathByHandle()
, and the expectation in t0001 that the recordedgitdir
will match whatpwd
says will be violated.Let's address this by comparing these paths in a case-insensitive manner when
core.ignoreCase
istrue
.Reported by Jameson Miller.