Reputation: 123
I ignore all files except for some folders as shown below in the .gitignore file.
*
!.gitignore
!/sample1/test1/
!sample1/test1/*
My issue is , it only keeps track of files under test1 folder which already exist , when i make new file, it ignores to track it.
may i know any solution ?
Upvotes: 3
Views: 467
Reputation: 546
You can not directly include already excluded nested direcory. *
excludes everything so firstly you need to negate exclusion for sample1
directory and later for test1
subfolder. That will work as you expect:
*
!.gitignore
!/sample1/
/sample1/*
!/sample1/test1
!/sample1/test1/*
Upvotes: 2
Reputation: 31389
This works when I try it:
*
!.gitignore
!sample1/
sample1/*
!sample1/test1/
!sample1/test1/*
Upvotes: 1