Video in progress

Strong Middle 🌿 Git

On macOS you renamed `orderService.java` to `OrderService.java`. Git does not see the change, and CI on Linux cannot compile. What is going on?

The macOS and Windows file systems are not case sensitive by default, and Git works there with core.ignorecase=true, so it does not notice a change of case alone. The old name stays in the repo, and on Linux javac fails because the public class name does not match the file name.

📖 Answer

The file name changed on disk, but Git's index still has orderService.java. CI clones on Linux and gets that:

error: class OrderService is public, should be declared in a file named OrderService.java

The right way is to rename through Git:

git mv orderService.java OrderService.java
git commit -m "OrderService fayl nomi tuzatildi"

In newer Git versions this works directly. If an older version gives an error, do it in two steps:

git mv orderService.java tmp.java
git mv tmp.java OrderService.java

An even worse case: someone on Linux committed both OrderService.java and orderService.java into one folder. When you clone on macOS, Git warns "the following paths have collided" and only one is left on disk, so git status always shows that something has changed.

To find them:

git ls-files | sort -f | uniq -di

The same goes for package folders: uz/shop/Payment/ and uz/shop/payment/.

Prevention: do not set core.ignorecase to false by hand, because on a case-insensitive disk it confuses Git. Instead, running the check above in CI, or rejecting paths that collide by case with a pre-receive hook, is more reliable.