I use a little perl script that just uses the 'git log branch1..branch2' command to figure out how many commits are in branch2 but not in branch1, and vice-versa. It runs this for every branch against a specified base.
I install this directly in the git-core folder as a file called git-brstatus. It shows:
> git brstatus master
Behind Branch Ahead
3 dev 2
That's for this branch graph:
┌─[HEAD]──[master]──6
├ 5
├ 4
│ ┌─[dev]──3
│ ├ 2
├─┘
└ 1
It should be easy to extend this to gather the last commit date for each branch. Here's the source.
#!/usr/bin/perl
if($#ARGV != 0) {
die "\nUsage: git-brstatus \n";
}
my $base = $ARGV[0];
my @branches = split(/\n/, `git branch`);
printf "%-10s%-30s%-10s\n", 'Behind', 'Branch', 'Ahead';
foreach my $branch (@branches) {
$branch =~ s/\s//g;
$branch =~ s/\*//g;
next if $branch eq $base;
my @ahead_commits = split(/\n/, `git log --oneline $base..$branch`);
my @behind_commits = split(/\n/, `git log --oneline $branch..$base`);
printf "%-10d%-30s%-10d\n", ($#behind_commits+1), $branch, ($#ahead_commits+1);
}