forked from chrishunt/dot-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.githelpers
50 lines (42 loc) · 1.1 KB
/
.githelpers
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
45
46
47
48
49
50
#!/bin/bash
function delete_local_merged_branches() {
git branch --merged master | grep -v master | xargs git branch -d
}
function delete_remote_merged_branches() {
git fetch origin
git remote prune origin
for BRANCH in `git branch -r --merged origin/master |\
egrep "^\s*origin/" |\
grep -v master |\
grep chrishunt |\
cut -d/ -f2-`
do
git push origin :$BRANCH
done
}
function weekly_summary() {
LAST_WEEK=$(date -v-7d +%m/%d)
STATS=$(
git log --since=1.week --oneline |
tail -n 1 |
awk '{ print $1 }' |
xargs git diff --shortstat
)
FEATURES=$(
git log --since=1.week --oneline |
egrep "Merge (pull|branch) "
)
FEATURES_COUNT=$(
echo "$FEATURES" |
sed '/^\s*$/d' |
wc -l |
awk '{ print $1 }'
)
echo "Stats ($LAST_WEEK - Today)"
echo "---------------------"
echo "$STATS"
echo
echo "Features ($FEATURES_COUNT)"
echo "-------------"
echo "$FEATURES"
}