2

I have a given extension directory containing plenty of other directories. Among those plenty, one particular named important that I want to be staged by git. The others I don't. So I created a .gitignore file within my extension directory with the following content:

*
!README
!.gitignore
!important/**

My goal was saying to Git:

  • ignore everything in this directory
  • but keep the README file
  • and also keep the .gitignore file
  • and please, do keep also the important directory

But this is not working, only README and .gitignore are kept. The syntax seems the right one to me so... I do not know where I am wrong.

Any suggestion is most welcomed.

Alexandre Bourlier
  • 3,972
  • 4
  • 44
  • 76

1 Answers1

2

You don't need the ** to recursively got through a directory.

*
!README
!.gitignore
!important/

Take a look at this answer Make .gitignore ignore everything except a few files

Community
  • 1
  • 1
VolkerK
  • 1,412
  • 13
  • 28