Last active
September 18, 2015 13:21
-
-
Save belchior/548dc5cee561fa7179b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function gitstatus { | |
local www='/var/www/html'; | |
local mydir=($PWD); | |
local notStaged='Changes not staged'; | |
local toCommit='Changes to be committed'; | |
local isAhead='is ahead'; | |
local ok='nothing to commit'; | |
cd $www; | |
printf "\n# ------------------------------ gitstatus ------------------------------ #\n"; | |
for dirname in `ls -d */`; do | |
cd $dirname; | |
if [ -d ".git" ]; then | |
local msg="$PWD -"; | |
if [ "`git status | grep -o "$notStaged"`" = "$notStaged" ]; then | |
msg="$msg <$notStaged>"; | |
fi | |
if [ "`git status | grep -o "$toCommit"`" = "$toCommit" ]; then | |
msg="$msg <$toCommit>"; | |
fi | |
if [ "`git status | grep -o "$isAhead"`" = "$isAhead" ]; then | |
msg="$msg <$isAhead>"; | |
fi | |
if [ "`git status | grep -o "$ok"`" = "$ok" ]; then | |
msg="$msg <$ok>"; | |
fi | |
printf "$msg\n"; | |
fi | |
cd $www; | |
done; | |
printf "# ----------------------------------------------------------------------- #\n\n"; | |
cd $mydir; | |
} | |
gitstatus; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment