git空資料夾批量新增 gitignore檔案

2022-09-10 19:18:13 字數 382 閱讀 3270

眾所周知,git提交不了空資料夾,所以只能向所有資料夾中新增.gitignore或.gitkeep檔案。

乙個個建立很麻煩,在網上搜了一堆,都不知道他們是怎麼想的,都執行不了,心累。

以下命令在linux中可直接在專案根目錄中執行,windows中需要在git bash中執行。

// 批量建立.gitignore檔案

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

// 批量刪除.gitignore檔案

find ./ -type f -name '.gitignore' -delete

Git筆記 新增檔案,資料夾,空資料夾

git status 檢視那些檔案被修改,那些檔案待提交 git status on branch develop your branch is up to date with origin develop nothing to commit,working directory clean表示當前沒...

linux 批量刪除空檔案或空資料夾

1.批量刪除空檔案 大小等於0的檔案 find name type f size 0c xargs n 1 rm f 2.刪除指定size大小檔案 find name type f size 1024c xargs n 1 rm f ps 此處即刪除1k大小的檔案.但注意不要用 size 1k,這個...

GIT推送時,空資料夾無法新增

自動化 中需要有存放測試報告的位置,但是推送 時又不想把沒用的本地報告推送到gitlab上,所以直接清空了report資料夾,然後pull到gitlab上。然後。一直報錯,找不到指定的目錄。排查發現,git對空目錄無法推送。如果推送乙個空目錄上去,則需要在它下面建立乙個檔案,什麼檔案都行。解決辦法 ...