开发者

How do I search for all my git repositories on my Mac? [closed]

开发者 https://www.devze.com 2023-01-27 12:22 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_开发问答

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

Closed 5 years ago.

Improve this question

I'm curious where I've scattered my git repositories across my mac. I'm trying to figure out how I could do a search to find them all so I can organize my life a bit. How can I do this?


Find is your friend. a .git folder will exist in each of your repositories so finding the location of them will give you all your repos.

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


Use find:

find ~ -name .git

This searches for the .git directory that is created in all (non-bare) Git repositories.

Choice of a suitable file to search for to find bare repositories is left as an exercise for the reader.


In shell:

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


Assuming you have locate, this should be much faster:

locate .git |grep git$

If you have gnu locate or mlocate, this will select only the git dirs:

locate -ber \\.git$
0

精彩评论

暂无评论...
验证码 换一张
取 消