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.
Things I have tried (not working, all produce the same error):
from Android Studio:
- deleting
FOOBar.java
, re-creatingFooBar.java
, adding/committing with Git - refactoring/renaming the file, adding/committing with Git
- File --> Invalidate Caches / Restart..., then trying one of the above
- Rebuild Project before/after any of the above
in the file system:
- deleting the
.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
thengit commit FooBar.java -m 'renamed from FOOBar.java to FooBar.java'