You can use the function check-ignore
to debug this problem:
git check-ignore -v template/
The output will be in the following format:
someGitignoreFile:123:someRule template/
...pointing you to the exact gitignore file, line number and particular ignore rule that led to the exclusion of template/
.
If this comes up empty, then the next possibility is that even though the folder itself is technically not ignored, every single file inside of it is, and since Git tracks files and not empty folders (you cannot add an empty folder to the index), this would have the same result and is abbreviated in git status --ignored
as showing the whole folder as ignored. You could check for that by going through all the files and checking them check-ignore
as well - in your case it's possible that for example there are only *.html
, *.png
and *.js
files inside template/
, all of which you ignored in your .gitignore
.