有 .gitnotice 文件吗?

Lot*_*mus 2 git gitignore

我有一个目录,我只想在其中跟踪许多文件中的几个。该.gitignore相比,文件将成为不必要的长时间.gitnotice。是否可以告诉 git 忽略指定文件以外的所有内容?

Mur*_*nik 6

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

dir_to_ignore/*
!dir_to_ignore/file_you_want_to_track
!dir_to_ignore/another_file_you_want_to_track
Run Code Online (Sandbox Code Playgroud)