#!/usr/bin/bash

for gr in $(find $HOME -maxdepth 3 -name '.git'); do
	wd=$(dirname $gr)
	pushd $wd &> /dev/null
	status=$(git status)
	if [[ $status =~ "ntracked files" ]]; then
		echo "Git repo $wd has untracked files"
	elif [[ $status =~ "branch is ahead" ]]; then
		echo "Git repo $wd has current branch not pushed"
	elif [[ $status =~ "nothing to commit" ]]; then
		true
	else
		echo "Git repo $wd needs attention"
	fi
done
