-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-multi-status.sh
executable file
·44 lines (42 loc) · 1.15 KB
/
git-multi-status.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
if [ $# -eq 0 ] ; then
ARGS="."
else
ARGS=$@
fi
for i in $ARGS ; do
for gitdir in `find $i -name .git` ; do
( working=$(dirname $gitdir)
cd $working
DiffAuthor=$(git show | grep Author | grep -v home-user)
if [ "$DiffAuthor" != "" ] ; then
continue
fi
RES=$(git status | grep -E '(Changes|Untracked|Your branch)')
STAT=""
grep -e 'Untracked' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT=" Untracked,"
fi
grep -e 'Changes not staged for commit' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT Changes not staged,"
fi
grep -e 'Changes to be committed' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT Changes to be committed,"
fi
grep -e 'Your branch is ahead' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT Branch is ahead"
fi
grep -e 'Your branch is behind' <<<${RES} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
STAT="$STAT Branch is behind"
fi
if [ -n "$STAT" ] ; then
echo -e "$working :$STAT"
fi
)
done
done