I want to exclude all direct files of the folder reports
but include all subfolders.
At first I didn't knew that there were any subfolders in this folder and I pushed reports/*
, to not push any automatically generated reports.
But now all the template files in the subfolders are marked as deleted in the staging area, and I want to fix this:
Exclude:
Include:
I have tried:
reports/*
!reports/*/
and
reports/*
!reports/*/*
but it doesn't seem to work.
Now everyting in the reports
folder is excluded.
But I want to only exclude all direct files and include all subfolders (and their contents).
.gitignore
file content:
/*
!/*/
First ignore everything then exclude folders recursively from the last match (everything).
Update
folder/*
!folder/*/