I have a repository with a subdirectory called mod/. I want this subdirectory to be included in the repository along with a README file within it, but I do not want other subdirectories within mod/ to be included. I have tried several fixes proposed here using .gitignore and committing changes, but git status
still shows everything in mod/ is being tracked. Currently, my .gitignore contains:
mod/* # Ignore everything in 'mod'...
!mod/README.md # ... except this.
But I have also tried setting the first line to:
/mod
mod/
./mod
./mod/*
and a few other variations...
To 'apply' these settings each time I edit .gitignore, I run:
git rm -r --cached .
git add .gitignore
git add mod/README.md
git commit -m "banging my head on the wall"
git status
and the status continues to show untracked files in mod/.