For example, I have a file named FOOBar.java
that I want to rename to FooBar.java
. After trying lots of stuff, I get the error:
Error:error: pathspec 'app/src/main/java/blahblah/FooBar.java' did not match any file(s) known to git.
FOOBar.java
, re-creating FooBar.java
, adding/committing with Gitin the file system:
.gradle
folder in the project folder, then trying one of the above in Android Studio
from the Git command line:
git mv FOOBar.java FooBar.java --force
then git commit FooBar.java -m 'renamed from FOOBar.java to FooBar.java'
The Windows and macOS file systems are case-insensitive (but case-preserving) by default. Most Linux filesystems are case-sensitive. Git was built originally to be the Linux kernel's version control system, so unsurprisingly, it's case-sensitive.
Git is a unix based code. its is case sensitive so it will allow you to have the same name in different cases, and as you except windows will not be tolerated for this. There is nothing you can do about it beside renaming your folders.
Just a note: gitignore is case-sensitive.
Windows’ file system is mostly case-insensitive, so you cannot rename a file by just changing its capitalization. Instead, you will have to use a temporary name in between.
Try the following from the command line:
git mv FOOBar.java FooBar.java.new
git mv FooBar.java.new FooBar.java
git commit -m 'Rename file'
I found out a very simple solution to this. Say you need to rename a java package "Activities" to "activities". This package contains several files and sub-packages
Follow the sequence of steps
Thats All Folks !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With