Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
for i in *.git ; do
( cd $i
RES=$(git status | grep -E '^# (Changes|Changed|Untracked)')
STAT=""
grep -e 'Untracked' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="[Untracked]"
fi
grep -e 'Changed' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT [Modified]"
fi
grep -e 'Changes' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT [Staged]"
fi
if [ -n "$STAT" ] ; then
echo "$i : $STAT"
fi
)
done
@subelsky

This comment has been minimized.

Copy link

subelsky commented May 23, 2012

this is EXACTLY what I needed, thanks for posting!

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.