git branch --remote | # get all branches
awk '{print "echo " $0 " `git merge-base" $0 " origin/master`"}' | # commands to produce "<branch name> <common ancesstor>"
xargs -0 bash -c | # execute commands
awk '{print "echo " $1 " - `git log --pretty=oneline " $2 "..." $1 " --merges | wc -l`"}' | # commands to count merges between
xargs -0 bash -c # execute commands