有没有办法在终端中列出 git 存储库? [英] Is there any way to list up git repositories in terminal?

查看:32
本文介绍了有没有办法在终端中列出 git 存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统上有几个 git 存储库,我想在终端中列出它们.

I have several git repositories on my system and I want to list them all in terminal.

我正在寻找的是这样的:

What I'm looking for is something like this:

/path/to/my/git/repo/1/REPONAME1
/path/to/my/git/repo/2/REPONAME2
/path/to/my/git/repo/3/REPONAME3

/path/to/my/git/repo/1/ REPONAME1
/path/to/my/git/repo/2/ REPONAME2
/path/to/my/git/repo/3/ REPONAME3

如果你能想出如何显示分支名称和回购的状态,例如.[master] c:0 u:1 d:0,那太好了.

If you can come up with how to show branch name and repo's status eg. [master] c:0 u:1 d:0, that would be great.

推荐答案

要列出系统上的所有 git 存储库,您可以在 bash shell 终端(在命令行)中运行以下命令并找到它们.

To list all the git repositories you have on your system you can run the following command in a bash shell terminal (at the command line) and find them.

find / -name .git -type d -exec dirname {} ;

这篇关于有没有办法在终端中列出 git 存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆