-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgt-gitstat.sh
More file actions
executable file
·32 lines (27 loc) · 958 Bytes
/
gt-gitstat.sh
File metadata and controls
executable file
·32 lines (27 loc) · 958 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
#!/bin/bash
ScriptLoc="$(dirname $0)/lib"
source ${ScriptLoc}/lib_colors.sh
for i in $( find /Users/bshea/scripts/github -type d -d 1 ); do
cd ${i}
git status &> /dev/null
if ! [ $? -gt 0 ]; then
#Print the folder ... minus the lead up
printf "${Yellow}$(echo "${i##*/}")${Color_Off}\n"
#Print the status of the repo
## git status | awk ' $1 != "#" { gsub(/ \(.*\)/,"",$0); print " "toupper(substr($0,1,1)) substr($0,2,1000) }'
git status | awk ' ! /^$|^ \(/ { gsub(/ \(.*\)/,"",$0); print " "toupper(substr($0,1,1)) substr($0,2,1000) }'
#Output the git log for the past 2 commits and when they happened
git --no-pager log --abbrev-commit --date=relative -2 |
awk '
$1 == "Date:" { gsub(" ","");
gsub(/^[ \t]+|[ \t]+$/,"");
sub("Date: ","",$0);
x=$0;
getline;
if ($0="\n") getline;
gsub(" ","");
gsub(/^[ \t]+|[ \t]+$/,"");
printf " %-15s %s\n", x, $0 }
'
fi
done