Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 32 lines (24 sloc) 963 Bytes
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
chomp(my @git_config = qx[ locate .git/config ]);
my @git_repos = map { s[/config$][]; $_ } @git_config;
for my $repo (@git_repos) {
# Find what branch they use
chomp(my $branch = qx[ git --git-dir=$repo symbolic-ref HEAD 2>/dev/null ]);
next unless $branch;
$branch =~ s[^refs/heads/][];
# Get the remote
chomp(my $remote = qx[ git --git-dir=$repo config remote.origin.url ]);
next unless $remote;
# Get unpushed commits
chomp(my @unpushed = qx[ git --git-dir=$repo log --pretty=format:'* %H %s' origin/$branch..HEAD 2>/dev/null]);
if (@unpushed) {
$repo =~ s[^/home/avar/][~/];
$repo =~ s[/.git$][];
my $num = @unpushed;
say "$num [$branch] $repo";
}
}
#for i in $(locate .git/config | perl -pe 's[\.git\K/config$][]'); do echo $i && git --git-dir=$i log --pretty=format:'* %H %s' origin/master..HEAD | cat; done | less