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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.