有 .gitnotice 文件吗?

Is there a .gitnotice file?

我有一个目录,我想在其中跟踪许多文件中的少数文件。 与 .gitnotice 相比,.gitignore 文件会变得不必要地长。 是否可以告诉 git 忽略除指定文件之外的所有内容?

您可以使用 ! 字符来否定 .gitignore 中的模式。因此,例如,您可以忽略除几个特定文件之外的整个目录:

dir_to_ignore/*
!dir_to_ignore/file_you_want_to_track
!dir_to_ignore/another_file_you_want_to_track