Reputation: 153251
I'd like to track files in this style
# Ignore everything
*
# But not these files...
!.gitignore
!/projectA/Makefile
!/projectB/Makefile
It turns out git can't track the Makefiles in the subdirectories of projectA
and projectB
. One solution is to create .gitignore
file in the subdirectories, but I don't like it because I have to manually create a lot of different .gitignore
files. Any idea how to do that in the .gitignore
of git root dir?
Upvotes: 1
Views: 972
Reputation: 46324
You can do something like this:
Put these pieces together to get these three lines in your .gitignore
!/projectA/
/projectA/*
!/projectA/Makefile
It's a bit verbose, but I don't know of a shorter method.
Upvotes: 4