想忽略一个目录下的所有文件(包括文件夹),但要保留这个文件夹,以便github上能体现该项目目录结构的完整性.
请问这种gitignore的规则应该怎么写?
滿天的星座2017-04-27 09:04:30
Git will ignore empty directories. The currently more mainstream approach, in addition to the one mentioned by @Millson, there is another approach that I personally find more convenient, which is to create a new one in the directory .gitkeep
文件(文件名其实随意,不过常见的是 .gitkeep
和 .keep
)
習慣沉默2017-04-27 09:04:30
Add the .gitignore file in the empty directory, the content is
# 忽略所有文件
*
# 除了这个文件
!.gitignore
Then git add empty can
漂亮男人2017-04-27 09:04:30
I remember that git cannot submit an empty directory, but it may be possible to work around it, first let there be files in the folder, and then delete the files. Just to provide ideas, you can try it