git提交空目录

1、刚建立项目时我们为了保证项目结构完整,要提交空的文件夹 , 但是git默认是忽略空目录的。

这时候我们只需要在git 根目录下执行

find . -type d -empty -exec touch {}/.gitignore \;

就可以上传空的文件夹了,本质上是在空目录里建立了一个.gitignore文件,等文件夹中新建了文件再把它删掉即可。

2、在顶层目录中的.gitignore中添加以下内容:

# Ignore everything in this directory
*
# Except this file
!.gitignore
发布了14 篇原创文章 · 获赞 5 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/laoyouji/article/details/91352588