I always thought I knew how to ignore and negate patterns, but I'm stumped. I have a baseline Drupal install and I'd like to ignore everything in the sites/
folder except for a couple of specific subdirectories: sites/all
and sites/my-project
.
.vagrant
settings.php
# A directory set aside for user contributed assets
uploads/
# All we care about is sites/all and sites/my-project
www/sites/*
!www/sites/all
!www/sites/my-project
Given the above .gitignore
file in the project root, when I do a git add .
, I get everything I'd expect from www/sites/all
, but nothing from www/sites/my-project
. What am I missing here? There's only one file that I care about (www/sites/my-project/settings.sample.php
) right now, but I can't figure out why it's not adding like everything else.
I know I could force it, but I want to understand the larger issue. What am I missing here? For whatever it's worth, this is my initial commit. I don't that it matters in any way, but I also don't know that it doesn't.
UPDATE
Whoops! Looks like the one file I care about is being ignored (which would explain why the directory is ignored). I have no idea where or why, but it gives me places to look...
I don't see a problem:
So everything seems to be working.
Try doing a
rm -rf .git/ && git init
just in case you previously ignored or added any other file.I thought maybe there was anything with the dot in
settings.php
being interpreted as an*
so it matched.sample.
, but don't seems to.Try deleting and re-
init
ing the repository.