forked from nomensa/FormBuilder-Laravel
-
Notifications
You must be signed in to change notification settings - Fork 2
/
getgit
40 lines (27 loc) · 767 Bytes
/
getgit
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
#!/bin/bash
rm -rf .git
git clone [email protected]:nomensa/FormBuilder-Laravel.git temp_git_repo
mv temp_git_repo/.git .git
rm -rf temp_git_repo
contributors="$(git log --pretty=%ae | sort | uniq)"
count="$( echo "$contributors" | grep -c '^' )"
printf "\n\e[0;32mWhat's your GitHub user email address?\033[0m\n\n"
email_addresses=()
i=0
for contributor in $contributors
do
printf " [\033[0;36m$i\033[0m] $contributor \n"
email_addresses[i]=$contributor
((i++))
done
printf "\n\e[0;33mEnter option number or specify a new address:\033[0m \n> "
read choice
re='^[0-9]+$'
if [[ $choice =~ $re ]] ; then
email=${email_addresses["$choice"]}
else
email=$choice
fi
printf "You have chosen %s \n" "$email"
git config user.email $email
exit 0