LoginSignup
1
1

More than 5 years have passed since last update.

カレントディレクトリ以下のGitリモートリポジトリ一覧を出力する

Last updated at Posted at 2016-12-11

Gitで管理しているレポジトリを~/src配下とかにまとめていると、数が多すぎてどこに置いたか分からなくなる時があるので、レポジトリのパスとリモートリポジトリの情報を一覧表示してくれるワンライナーがあると便利。

find-git-remotes
#!/bin/zsh
# カレントディレクトリ以下の、Gitのリモートリポジトリ一覧を出力します
# * bundleを含むディレクトリは除外しています。Bundler管理していると出力数が多すぎて出力を汚染するので
# * zsh, realpath が必要です
find . -name ".git" -not -iwholename '*/bundle*' -type d -exec zsh -c 'repopath=`realpath {}/..`; echo -e "\n\e[96mGit repository path: ${repopath}\e[0m"' \; -exec git --git-dir {} remote -v \;

~/binとかに置いておき、いつでも実行できるようにしておくともうちょっと便利。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1