-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit_count.sh
More file actions
executable file
·51 lines (44 loc) · 1.43 KB
/
commit_count.sh
File metadata and controls
executable file
·51 lines (44 loc) · 1.43 KB
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
51
#!/bin/bash -
#===============================================================================
#
# FILE: commit_count.sh
#
# USAGE: ./commit_count.sh
#
# DESCRIPTION: Gives a count of commits across all branches in a list of
# repos. Search uses git log and email address to search history.
#
# TODO: Replace base-path-directory and email-id with correct values
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: YOUR NAME (),
# ORGANIZATION:
# CREATED: 09/03/2018 09:32
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
BASE=<base-path-directory>
COUNTER=0
function git_cmd() {
git log --all --author=<email-id> --pretty=oneline | wc -l
}
repos=( "$BASE/<repo-1>"
"$BASE/<repo-2>"
"$BASE/<repo-3>"
)
printf "****************************************\n"
printf " Repo Name # of Commits\n"
printf "****************************************\n"
for i in "${repos[@]}"
do
cd "$i" || echo "Repo $i doesn't exist. Moving to next repo ..."
COUNT=$(git_cmd)
COUNTER=$((COUNTER + COUNT))
printf " %-20s %s\n" "$(basename "$i")" "$COUNT"
done
printf " =========================\n"
printf " Total Repos %s\n" "${#repos[@]}"
printf " Total Commits %s\n" "$COUNTER"