Git's not detecting file name casing change
Asked Answered
N

1

11

I've currently facing a rather odd issue, git is not looking for case changes on my files. I had app.module.ts and outside.dto.ts and I've changed them to App.module.ts and Outside.dto.ts.

I'm not sure wether git is not picking those changes or if that's a very specific issue with my repository, but my repository is still with the lowercase filename even tough I've commited multiple times with the different filename casing.

Pretty sure it doesn't make a difference, but since I've never seen this happen on GitHub, I think it won't hurt to mention I'm using Azure Repo.

Necrophobia answered 23/2, 2022 at 2:13 Comment(4)
If you're on a system in which file case is irrelevant (e.g., default Windows and macOS file systems) so that opening readme.txt opens the README.txt file, Git is correct to ignore file-name-case changes because they're not relevant. You can temporarily turn off core.ignorecase to make Git believe they are relevant, but be sure to turn it back on again later, otherwise Git will believe that your OS is suddenly capable of storing two different files that differ only in case.Nosegay
Yep, forgot to mentioned I tried that, but Azure policies are stopping me from pushing, here's the message that shows up when I try to push with ignorecase turned off: The tree object ... was rejected: The file 'app.module.ts' and the file 'App.module.ts' pushed differ in case. You must remove or rename one of them or disable case-enforcement (see https://aka.ms/git-platform-compat). error: remote unpack failed: error Any way to solve this? :/Necrophobia
Azure (not Git, just Azure) has an extra feature where it checks Git commits for anything that will trip up Windows, and refuses to allow them. To avoid triggering this Azure feature, you have two options: make sure none of your commits do that, or don't use Azure. In this case you have at least one commit that, when checked out, tries to create both app.module.ts and App.module.ts. Clone onto a Linux system, find the commit, and remove the commit with a repository surgery program like filter-repo.Nosegay
(Or, of course, "don't use Azure", but that's probably not desirable :-) )Nosegay
N
24

Try setting ignorecase to false in your git config. I just had the same issue and it worked for me

git config core.ignorecase false

Nonstandard answered 23/2, 2022 at 5:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.