-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-status.sh
More file actions
executable file
·41 lines (37 loc) · 899 Bytes
/
git-status.sh
File metadata and controls
executable file
·41 lines (37 loc) · 899 Bytes
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
#!/bin/bash
## green means no uncommited changes -- you're good
## yellow means staged but not committed changes
## red means changes exist, nut no staged changes yet
## blue means not a git repo
textreset=$(tput sgr0) # reset the foreground colour
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
checkdirs=$@
if [ "$checkdirs" == "" ]; then
checkdirs=(.)
fi
for checkdir in $checkdirs ; do
for dir in `ls $checkdir` ; do
if [ ! -d "$checkdir/$dir/.git" ] ; then
echo "${blue}$checkdir/$dir${textreset}"
else
cd "$checkdir/$dir"
lines=`git status --porcelain`
if [ ${#lines[@]} -lt 2 -a "$lines" == "" ] ; then
echo "${green}$dir${textreset}"
else
echo "${red}$dir${textreset}"
for l in $lines ; do
if [ ${#l} -lt 3 ] ; then
printf %s "$l "
else
echo $l
fi
done
fi
cd ..
fi
done
done