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.

4

1 回答 1

2

您不需要**递归地通过目录。

*
!README
!.gitignore
!important/

看看这个答案Make .gitignore 忽略除少数文件之外的所有内容

于 2012-10-25T13:33:16.550 回答