Reputation: 8029
I want to ignore all files and folders except five folders that begin with a certain prefix. For example
I want to ignore everything except folders 3 and 4 and their content
I tried this but it didn't work
*
!.gitignore
!/prefix_*
I also tried writing the full names of folder 3 and 4 but it didn't work either. git status
tells me that there are no files to commit.
Upvotes: 0
Views: 1859
Reputation: 925
This will ignore all root files and root sub-directories, excluding the .gitignore file and the directories with the prefix prefix_
/*
/*/
!.gitignore
!/prefix_*
Git should now track the files in the directories with prefix_
and ignore the rest.
Upvotes: 2