I have a directory structure similar to this:
root/
.gitignore
subdir/
.gitignore
subsubdir1/
file.xml
image.png
subsubdir2
file.xml
image.jpg
I want to ignore all files from subdir
except XML files.
the second .gitignore
looks like this:
* # ignore everything in this directory and its subdirectories
!*/ # do not ignore subdirectories
!*.xml # do not ignore xml files
!.gitignore # and of course have this .gitignore file included too
according to this and various other posts here on SO and other sites, this should work just fine, but for some reason git status
shows me that all the files in subdir
folder are untracked.
I have used git rm --cached
to remove all files that have been tracked before .gitignore
was added, but that still did not do the trick.
Do you have any clue, what would fix this ?
P.S.: In case it matters I am using git on Windows.