git 不区分大小写吗? [英] Is git not case sensitive?
问题描述
在我的部分名为 _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
.
cygwin下的Git提交新名字后忽略了大小写,所以我在目标repo中手动改了名字.
Git under cygwin ignored the case after commiting the new name, so I changed the name by hand in the target repo.
现在它有时会将提交的 _electronics
部分更改为 _Electronics
.
Now it sometimes changes the commited _electronics
partial to _Electronics
.
我做错了什么?
推荐答案
它将被视为 2 种不同的事物,但会在不区分大小写的系统上导致问题.如果是这种情况,请确保您使用制表符完成任何路径或文件名.此外,要在这种情况下更改某些内容的名称,请执行以下操作:
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"
这也与调整目录名称有关:git mv 并且只更改目录的大小写
This is related to adjusting directory names as well: git mv and only change case of directory
这篇关于git 不区分大小写吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!