-1

I have this file structure

enter image description here

Inside Android directory there is pizzaSample directory that contains .idea that i want to ignore.(Android/pizzaSample/.idea)

What i have tried inside my .gitignore file to ignore a directory or a file is as follows

Android/
Android/pizzaSample/
Android/pizzaSample/.idea/misc.xml

the above code does not ignore any of the file or the Android directory itself.Can someone help what should i do to ignore a file or a directory?

UPDATED

i tried to add a dummy folder(dummyfolder) that contains a dummy file(dummyfile.txt) and added a single line of my .gitignore file

      Android/
      Android/pizzaSample/
      Android/pizzaSample/.idea/misc.xml
      dummyfolder/

the code dummyfolder/ ignores the intire folder including dummyfile.txt and even dummyfolder/* will also do the work.. but i dont understand why when i put Android/ or Android/* in my .gitignore does not work.

This is the file that i want to ignore enter image description here

jameshwart lopez
  • 2,993
  • 6
  • 35
  • 65

1 Answers1

4

If a file should be ignored, but is not, try first to remove it, in case it was already versioned (which seems to be the case, since its status is "modified").

git rm --cached -- Android/pizzaSample/.idea/misc.xml

Then check with git status if the file show up

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250