Skip to content

Instantly share code, notes, and snippets.

@douglasnaphas
Last active May 28, 2020 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglasnaphas/01f01089bb4da05cc5988930582a1db1 to your computer and use it in GitHub Desktop.
Save douglasnaphas/01f01089bb4da05cc5988930582a1db1 to your computer and use it in GitHub Desktop.
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