Skip to content

Instantly share code, notes, and snippets.

@maximebf
Last active August 29, 2015 14:07
Show Gist options
  • Save maximebf/e7b8b186db84578d3d9d to your computer and use it in GitHub Desktop.
Save maximebf/e7b8b186db84578d3d9d to your computer and use it in GitHub Desktop.
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