如何在Mac上搜索我的所有git存储库?

时间:2010-11-30 22:20:56

标签: git macos

我很好奇我在我的mac上分散了我的git存储库。我正在试图找出如何进行搜索以找到它们所以我可以整理一下我的生活。我怎么能这样做?

4 个答案:

答案 0 :(得分:27)

找到你的朋友。 .git文件夹将存在于您的每个存储库中,因此查找它们的位置将为您提供所有存储库。

find /Users/username -name ".git" -print

答案 1 :(得分:9)

使用find

find ~ -name .git

这将搜索在所有(非裸)Git存储库中创建的.git目录。

选择一个合适的文件来搜索查找裸存储库是留给读者的练习。

答案 2 :(得分:7)

在shell中:

find $HOME -type d -name ".git"

答案 3 :(得分:4)

假设你有locate,这应该快得多:

locate .git |grep git$

如果你有gnu locate或mlocate,这将只选择git dirs:

locate -ber \\.git$
相关问题