gitignore 添加空目录
过去多啦不再A梦
过去多啦不再A梦 2017-04-27 09:02:30
0
3
883

想忽略一个目录下的所有文件(包括文件夹),但要保留这个文件夹,以便github上能体现该项目目录结构的完整性.

请问这种gitignore的规则应该怎么写?

过去多啦不再A梦
过去多啦不再A梦

reply all(3)
滿天的星座

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)

習慣沉默

Add the .gitignore file in the empty directory, the content is

# 忽略所有文件
*
# 除了这个文件
!.gitignore

Then git add empty can

漂亮男人

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template