Last active
August 29, 2015 14:07
-
-
Save maximebf/e7b8b186db84578d3d9d to your computer and use it in GitHub Desktop.
mgitstatus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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