Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Print repos in subdirectories of the current directory that are not on master or have dirty working directories
for d in $(ls) ; do
if [[ ! -d ${d}/.git ]] ; then
continue ;
fi
BRANCH="$(git -C ${d} rev-parse --abbrev-ref HEAD)" ;
if [[ "${BRANCH}" != "master" ]] ; then
echo ${d} "${BRANCH}" ;
continue ;
fi
if [[ $(git -C ${d} status --porcelain 2>/dev/null | wc -l) -ne 0 ]] ; then
echo ${d} ;
continue ;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.