Skip to content

Instantly share code, notes, and snippets.

@maximebf maximebf/mgitstatus
Last active Aug 29, 2015

Embed
What would you like to do?
mgitstatus
#!/bin/bash
# Display the status of all git directories in the current directory
show() {
cd $1
branch=`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\\\\\1/`
if [ -n "`git status 2> /dev/null | grep 'nothing to commit'`" ]; then
status="\e[32mok\e[0m"
else
status="\e[31mmodified\e[0m"
fi
echo -e "\e[1m$1\e[0m (\e[34m$branch\e[0m): \e[1m$status\e[0m"
cd ..
}
for repo in `ls`
do
if [ -d $repo ] && [ -d $repo/.git ]; then
show $repo
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.