I am using git for version control and need to delete a file from the repo.
Earlier I had folder structure as follows in git repo
ProjectName/ src/ test/ java/ vanilla/ file1.java file2.java
Later on my local copy I added another folder endToendTests under vanilla and moved file1.java and file2.java to the new folder, committed and pushed. I thought the new folder and file move would reflect in repo too. But did not confirm in repo (I know my bad #cringing).
However after some more commits and pushes from me and my colleague I realized these files now show up in two places in repo under vanilla and under endToendTests folder. So I went looking for how to delete these files from under vanilla in git repo (they do not exist in two places on my local). My search lead me to these stack answers How to remove files from the GitHub repository? and How can I delete a file from git repo?
I tried below command
git rm ProjectName/src/test/java/vanilla/file1.java
and got below error
fatal: pathspec ProjectName/src/test/java/vanilla/file1.java did not match any files
Further search about this error led me try
git rm .ProjectName/src/test/java/vanilla/file1.java
This as well did not work.
Is the syntax to specify filepath incorrect? or is my command incorrect?
Any pointers on how I can get this file deleted from git repo is very much appreciated.
Thanks for your time!!