Reputation: 13206
In my .gitignore
I have:
*
!file.txt
!folder1
!folder1/
!folder1/*
This almost does what I want except whenever I add something beyond one folder past folder/
it does not get committed. For instance folder1/test/folder2/test.txt
will not be committed. Is there any way to fix this without adding endless *
to my .gitignore
?
Upvotes: 0
Views: 260
Reputation: 1627
EDIT:
I kept playing with this, and here is a shorter version
/* # ignore everything in root
!/folder1 # except folder1
ORIGINAL:
Give this a shot
*
!folder1
!folder1/**
From gitignore documentation:
Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:
...
- A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth.
...
Upvotes: 4