git删除大小写不同的相同文件 [英] Git remove same file with different capitalization
问题描述
由于某些必要,我更改了.git/config
ignorecase = false
以便区分大小写.然后将文件从大写重命名为小写.例如,我将Account_Model.php
重命名为Account_model.php
,甚至是其他分支.
Because of some necessities, I've changed .git/config
ignorecase = false
in order to make case sensitive. Then rename file from upper case to lower case. For example, I renamed Account_Model.php
to Account_model.php
manually, even other branches.
通过不同的大小写,git生成了Uncommitted changes
,然后我以小写提交了新文件(git假定使用小写的新文件).
By the different case, git makes the Uncommitted changes
, then I committed the new files with lower case (git assume the lower case new files).
现在我有麻烦了.我将要部署的服务器的仓库拉出,该目录创建了2个文件.一个是Account_model.php
(我想要的),另一个是Account_Model.php
.
Now I'm in trouble. I pull the repo for the server where to have deployments, the directory creates 2 files. One is Account_model.php
(What I want) and the other is Account_Model.php
.
它们变成了单独的两个文件!但是回到本地,我在目录中只看到1个文件. (由于这一个,我无法删除大写的一个)
They became separate two files! But turn back to my local, I only see 1 file in the directory. (Because of the one, I cannot delete the upper case one)
如果我更改其中一些,则大小写不同的两个文件将同时发出警报.差异显示相同的修改.
If I change some of them, the two file with different cases will alert at the same time. The diff shows the same modifies.
但是我只能在目录中看到一个.
But I only can see only one in the directory.
我无法删除大写字母. (如果可以的话,我认为小写字母也会被删除.
I cannot delete the upper case one. (If could, I think the lower case one would be delete too.
有一种方法可以通过命令更改大小写.我知道,我选择了错误的方式.
There's a way can change case by the command. I know, I chose the wrong way.
那么我该如何处理这两个大小写的文件,并永久保留更改(只有一个小写的文件)?
So how can I deal with that two case files, and keep the changes (only one file with lower case) forever?
非常感谢您.
推荐答案
默认情况下,OS X的文件系统不区分大小写.因此,如果您在Git存储库中有两个名称相同但大小写不同的文件,则会遇到问题.
OS X's filesystem is, by default, case-insensitive. So if you have two files in a Git repository with the same name but different cases you get the problem you're having now.
一种简单的解决方法是使用磁盘工具"来创建区分大小写的磁盘映像,将存储库克隆到该磁盘映像上,在那里修复问题,然后推送修复程序.
A simple work around is to use Disk Utility to create a case-sensitive disk image, clone the repo onto that, fix the problem there, and push the fix.
制作磁盘映像...
- 打开磁盘实用程序.
- 执行文件->新图像->空白图像.
- 将格式"设置为OS X扩展(区分大小写,日记).
它将自动安装并在/Volumes
中等待您.克隆后,您应该会看到两个文件,并可以根据需要使用它们.
It will automatically be mounted and waiting for you in /Volumes
. After you clone you should see both files and can do with them as you please.
这篇关于git删除大小写不同的相同文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!