git 提交java文件在Windows下不区分大小写问题

来源:互联网 发布:影视系统网站cms 编辑:程序博客网 时间:2024/05/21 18:30

前几天提交的代码(因文件中修改了类名字),在本地没有任何问题,代码合并其他分支后发现JAVA文件与JAVA文件中的class类名不一致。

确认问题:

git 默认对文件名大小写不敏感

处理办法:

windows下在git中修改文件的大小写,请使用以下命令:

    command: git mv --force AllinpayProperties.java AllinPayProperties.java
example
    command: git mv --force AllinpayProperties.java AllinPayProperties.java 
执行后
    command: git status
执行结果
     modified:   src/main/java/*/*/AllinpayProperties.java     deleted:    src/main/java/*/*/AllinPayProperties.java
GIT效果
 gitlab上JAVA文件AllinpayProperties.java已经被修改成AllinPayProperties.java 

其他处理方式:

1、类似linux的git命令

     command: git mv -f AllinpayProperties.java AllinPayProperties.java

2、修改git配置文件

方法1
     command: git add ignorecase = false to [core] in .git/config
方法2
     command: git config core.ignorecase false
1 0