I'd like to only track certain directories in git in a larger project, where most directories will be excluded and only a few will be tracked. So, I wanted to use the not-operators in my .gitignore or excludes file, ja?
Why is this happening:
% mkdir wtfgit
% cd wtfgit
% git init
Initialized empty Git repository in /home/foobar/wtfgit/.git/
% mkdir iwantthesefiles
% touch iwantthesefiles/foo
% mkdir idontwantthesefiles
% touch idontwantthesefiles/bar
% vim .gitignore
% cat .gitignore
*
!iwantthesefiles/
% git add --all
% git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
The "not" syntax works fine for files in the highest directory.
% touch baz
% vim .gitignore
% cat .gitignore
*
!iwantthesefiles/
!baz
% git add --all
% git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: baz
#
How can I get this to give me baz and foo as git tracked files? (Basically, how does the directory NOT-style globbing work at all?! It seems not to.)
Thanks!