眾所周知邓了,git提交不了空文件夾炭菌,所以只能向所有文件夾中添加.gitignore或.gitkeep文件潭辈。
一個(gè)個(gè)創(chuàng)建很麻煩嫡锌,在網(wǎng)上搜了一堆,都不知道他們是怎么想的蚕苇,都執(zhí)行不了歌溉,心累娃闲。
以下命令在linux中可直接在項(xiàng)目根目錄中執(zhí)行忱详,windows中需要在git bash中執(zhí)行围来。
// 批量創(chuàng)建.gitignore文件
find . -type d -empty -exec touch {}/.gitignore \;
// 批量刪除.gitignore文件
find ./ -type f -name '.gitignore' -delete