0
我試圖從庫中此刪除所有混帳文件:Unix的「發現」,而不降入匹配目錄
find . -name ".git*" -exec rm -rf {} \;
然而,rm
警告說,文件無法刪除(因爲它們的父目錄早已已被刪除)。
有沒有辦法讓find
停止遞歸找到匹配的目錄?
E.g. find...
/.gitmodules
/.git/stuff
/.git/.gitfile
...產生
/.gitmodules
/.git
可能的重複[在unix下使用find來移除一個包含其所有內容的目錄](http://stackoverflow.com/questions/24723499/remove-a-directory-with-all-of-its-contents-using -find-under-unix) – BroSlow
所以你可以做一些類似'find -type d -name「.git *」-prune -exec rm -rf {} \;' – BroSlow