git 不区分大小写吗?
在我的部分的第一个承诺中,它以大写字母开头,然后我将其更改为 _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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
它将取决于 core.ignorecase 配置值,该值在区分大小写的文件系统中设置为 false,在 Windows 上的 msysgit 中设置为 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.More detail in this reply to Changing capitalization of filenames in Git.
它会被视为两个不同的东西,但会在不区分大小写的系统上引起问题。如果是这种情况,请确保您使用制表符补全所有路径或文件名。此外,要在这种情况下更改某些内容的名称,请执行以下操作:
这是一种明确的方式,可以进行更改提交,然后折叠提交。一种更短的方法是同时操作索引和工作文件夹:
这也与调整目录名称有关: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:
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:
This is related to adjusting directory names as well: git mv and only change case of directory
这要容易得多:
This is far easier:
在我的场景中,我有两个文件夹
tests
和Tests
,它们在 Github 中显示为两个单独的文件夹,但在 Windows 中显示为单个Tests
文件夹。我的目标是将它们合并到测试
中。我使用了以下方法:
temp
Tests
中的所有内容复制到temp
Tests
temp
重命名为tests
In my scenario I had two folders
tests
andTests
which showed as two separate folders in Github but a singleTests
folder in Windows. My aim was to combine them both intotests
.I used the following approach:
temp
Tests
totemp
Tests
git rm Tests -r
temp
totests
我试图解决这个问题,并且在 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.