git 不区分大小写吗?

发布于 2024-12-21 00:14:34 字数 212 浏览 2 评论 0原文

在我的部分的第一个承诺中,它以大写字母开头,然后我将其更改为 _Electronics

cygwin下的Git在提交新名称后忽略了大小写,因此我在目标存储库中手动更改了名称。

现在,它有时会将提交的 _Electronics 部分更改为 _Electronics

我做错了什么?

In the first commitment of my partial called _Electronics it was written beginning with a capital letters, then I changed it to _electronics.

Git under cygwin ignored the case after commiting the new name, so I changed the name by hand in the target repo.

Now it sometimes changes the commited _electronics partial to _Electronics.

What have I done wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

墨落成白 2024-12-28 00:14:34

它将取决于 core.ignorecase 配置值,该值在区分大小写的文件系统中设置为 false,在 Windows 上的 msysgit 中设置为 true。

核心.ignorecase

如果为 true,此选项将启用各种解决方法,使 git 能够在不区分大小写的文件系统(例如 FAT)上更好地工作。为了
例如,如果目录列表在 git 期望时找到“makefile”
“Makefile”,git会假设它确实是同一个文件,并继续
将其记住为“Makefile”。

默认值为 false,但 git-clone(1) 或 git-init(1) 将在存储库时探测并设置 core.ignorecase true(如果适用)
已创建。

更多详细信息,请参阅在 Git 中更改文件名的大小写

It is going to depend on the core.ignorecase configuration value, which is set to false in case-sensitive filesystems and true in msysgit on Windows.

core.ignorecase

If true, this option enables various workarounds to enable git to work better on filesystems that are not case sensitive, like FAT. For
example, if a directory listing finds "makefile" when git expects
"Makefile", git will assume it is really the same file, and continue
to remember it as "Makefile".

The default is false, except git-clone(1) or git-init(1) will probe and set core.ignorecase true if appropriate when the repository
is created.

More detail in this reply to Changing capitalization of filenames in Git.

烟─花易冷 2024-12-28 00:14:34

它会被视为两个不同的东西,但会在不区分大小写的系统上引起问题。如果是这种情况,请确保您使用制表符补全所有路径或文件名。此外,要在这种情况下更改某些内容的名称,请执行以下操作:

mv file.txt temp.txt
git add -A
git commit -m "renaming..."
mv temp.txt File.txt
git add -A
git commit --amend -m "Renamed file.txt to File.txt"

这是一种明确的方式,可以进行更改提交,然后折叠提交。一种更短的方法是同时操作索引和工作文件夹:

git mv file.txt temp.txt
git mv temp.txt File.txt
git commit -m "Renamed file.txt to File.txt"

这也与调整目录名称有关:git mv 并且仅更改目录的大小写

It will be seen as 2 different things but will cause you issues on a non-case-sensitive system. If this is the case, ensure you are tab-completing any paths or file names. Further, to change the name of something in just the case, do this:

mv file.txt temp.txt
git add -A
git commit -m "renaming..."
mv temp.txt File.txt
git add -A
git commit --amend -m "Renamed file.txt to File.txt"

This is an explicit way of making changes committing them, then collapsing the commits. A shorter way to do it is to manipulate the index and working folder all in one:

git mv file.txt temp.txt
git mv temp.txt File.txt
git commit -m "Renamed file.txt to File.txt"

This is related to adjusting directory names as well: git mv and only change case of directory

岁月打碎记忆 2024-12-28 00:14:34

这要容易得多:

git mv Electronics electronics -f
git commit -m "That was easy!"

This is far easier:

git mv Electronics electronics -f
git commit -m "That was easy!"
绝影如岚 2024-12-28 00:14:34
git config --system core.ignorecase false
git config --system core.ignorecase false
云雾 2024-12-28 00:14:34

在我的场景中,我有两个文件夹 testsTests,它们在 Github 中显示为两个单独的文件夹,但在 Windows 中显示为单个 Tests 文件夹。我的目标是将它们合并到测试中。

我使用了以下方法:

  1. 创建一个新文件夹temp
  2. Tests中的所有内容复制到temp
  3. 删除Tests
  4. 执行< code>git rm Tests -r
  5. temp 重命名为 tests

In my scenario I had two folders tests and Tests which showed as two separate folders in Github but a single Tests folder in Windows. My aim was to combine them both into tests.

I used the following approach:

  1. Create a new folder temp
  2. Copy all content from Tests to temp
  3. Delete Tests
  4. execute git rm Tests -r
  5. Rename temp to tests
樱花细雨 2024-12-28 00:14:34

我试图解决这个问题,并且在 Windows10 上成功了

假设 bitbucket TEST 和 test 上有两个文件夹,但是当我在磁盘上克隆存储库时,它只创建 TEST 并且我想将 test 保留为 git 上的单个文件夹,其中包含所有文件。

我需要在命令行上执行以下命令
git mv 测试 test1 -f
git mv text1 测试 -f
git commit -m“重命名...”
git push

现在您将看到 bitbucket 上的文件夹层次结构已更正。

I have tried to solve the issue and it was successful on Windows10

Lets suppose there are two folders on bitbucket TEST and test but when I clone repo on disk it creates only TEST and I want to keep test as single folder on git which contains all files.

I will need to execute following commands on command line
git mv TEST test1 -f
git mv text1 test -f
git commit -m "renaming..."
git push

Now you will see that folder hierarchy is corrected on bitbucket.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文