简体   繁体   English

如何删除某个文件夹中的所有git存储库?

[英]How to delete all git repositories in a certain folder?

I'm looking for an option to delete ALL .git folders on my local folder on the PC, so it won't be that massive.我正在寻找一个选项来删除 PC 上本地文件夹中的所有.git文件夹,所以它不会那么大。

I have tried to use rimraf library , but there are no filter options in there,我曾尝试使用rimraf,但其中没有过滤器选项,

Any ideas?有任何想法吗?

This gist offers the more complete command, to execute in a bash session, even on Windows: 这个要点提供了更完整的命令,即使在 Windows 上也可以在 bash 会话中执行:

find . \( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" \) -prune -exec rm -rf -- {} +

So it does not use npm , but rather a native Git bash session.因此它不使用npm ,而是使用本机 Git bash 会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM