#!/bin/bash

for dir in $(find . -maxdepth 1 ! -path . -type d); 
do
  cd $dir
  find . -type d -name '.git*' ! -path "*/poky-tmp/*" 2>/dev/null | \
      sed 's/\.git$//g' | \
      xargs -I '{}' sh -c 'readlink -e {};' | \
      uniq | \
      sort | \
      xargs -I '{}' sh -c 'cd {}; git push --follow-tags';
  cd ..
done;