众所周知,git提交不了空文件夹,所以只能向所有文件夹中添加.gitignore或.gitkeep文件。
一个个创建很麻烦,在网上搜了一堆,都不知道他们是怎么想的,都执行不了,心累。
以下命令在linux中可直接在项目根目录中执行,windows中需要在git bash中执行。
// 批量创建.gitignore文件
find . -type d -empty -exec touch {}/.gitignore \;
// 批量删除.gitignore文件
find ./ -type f -name '.gitignore' -delete