-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-refresh.sh
132 lines (126 loc) · 4.48 KB
/
git-refresh.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#Summary: This script will perform a git reset in all different projects.
#If unsaved changes are found, would ask for confirmation
#Variables
RED='\033[1;36m';
PURPLE='\033[1;35m';
NC='\033[0m';
ECOMMERCE_ADMIN_WEB='Ecommerce admin web';
ECOMMERCE_API='Ecommerce API';
ECOMMERCE_SHARED='Ecommerce Shared';
ECOMMERCE_IDENTITY='Ecommerce Identity';
ECOMMERCE_TOOLS='Ecommerce Tools';
#ecommerce-admin-web
printf "${PURPLE}######################## ${ECOMMERCE_ADMIN_WEB} ########################${NC}"
cd "$(dirname "$0")\.."
cd ./ecommerce-admin-web
printf "\n\n${ECOMMERCE_ADMIN_WEB}:\n\n ${RED}>>git status\n\n${NC}"
git status
printf "\n\n${ECOMMERCE_ADMIN_WEB}:\n\n ${RED}>>git reset head --hard\n\n${NC}"
while true; do
printf "\n"
read -p "Do you wish to reset this repo? = ${ECOMMERCE_ADMIN_WEB}" yn
printf "Response: ${yn}\n\n"
case $yn in
"") git reset head --hard;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no";;
esac
done
printf "\n\n${ECOMMERCE_ADMIN_WEB}:\n\n ${RED}>>git clean -fd\n\n${NC}"
git clean -fd
printf "\n\n${ECOMMERCE_ADMIN_WEB}:\n\n ${RED}>>git checkout master\n\n${NC}"
git checkout master
printf "\n\n${ECOMMERCE_ADMIN_WEB}:\n\n ${RED}>>git pull\n\n${NC}"
git pull
#ecommerce-api
printf "${PURPLE}######################## ${ECOMMERCE_API} ########################${NC}"
cd "$(dirname "$0")\.."
cd ./ecommerce-api
printf "\n\n${ECOMMERCE_API}:\n\n ${RED}>>git status\n\n${NC}"
git status
printf "\n\n${ECOMMERCE_API}:\n\n ${RED}>>git reset head --hard\n\n${NC}"
while true; do
printf "\n"
read -p "Do you wish to reset this repo? = ${ECOMMERCE_API}" yn
printf "Response: ${yn}\n\n"
case $yn in
"") git reset head --hard;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no";;
esac
done
printf "\n\n${ECOMMERCE_API}:\n\n ${RED}>>git clean -fd\n\n${NC}"
git clean -fd
printf "\n\n${ECOMMERCE_API}:\n\n ${RED}>>git checkout master\n\n${NC}"
git checkout master
printf "\n\n${ECOMMERCE_API}:\n\n ${RED}>>git pull\n\n${NC}"
git pull
#ecommerce-shared
printf "${PURPLE}######################## ${ECOMMERCE_SHARED} ########################${NC}"
cd "$(dirname "$0")\.."
cd ./ecommerce-shared
printf "\n\n${ECOMMERCE_SHARED}:\n\n ${RED}>>git status\n\n${NC}"
git status
printf "\n\n${ECOMMERCE_SHARED}:\n\n ${RED}>>git reset head --hard\n\n${NC}"
while true; do
printf "\n"
read -p "Do you wish to reset this repo? = ${ECOMMERCE_SHARED}" yn
printf "Response: ${yn}\n\n"
case $yn in
"") git reset head --hard;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no";;
esac
done
printf "\n\n${ECOMMERCE_SHARED}:\n\n ${RED}>>git clean -fd\n\n${NC}"
git clean -fd
printf "\n\n${ECOMMERCE_SHARED}:\n\n ${RED}>>git checkout master\n\n${NC}"
git checkout master
printf "\n\n${ECOMMERCE_SHARED}:\n\n ${RED}>>git pull\n\n${NC}"
git pull
#ecommerce-shared
printf "${PURPLE}######################## ${ECOMMERCE_IDENTITY} ########################${NC}"
cd "$(dirname "$0")\.."
cd ./ecommerce-identity
printf "\n\n${ECOMMERCE_IDENTITY}:\n\n ${RED}>>git status\n\n${NC}"
git status
printf "\n\n${ECOMMERCE_IDENTITY}:\n\n ${RED}>>git reset head --hard\n\n${NC}"
while true; do
printf "\n"
read -p "Do you wish to reset this repo? = ${ECOMMERCE_IDENTITY}" yn
printf "Response: ${yn}\n\n"
case $yn in
"") git reset head --hard;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no";;
esac
done
printf "\n\n${ECOMMERCE_IDENTITY}:\n\n ${RED}>>git clean -fd\n\n${NC}"
git clean -fd
printf "\n\n${ECOMMERCE_IDENTITY}:\n\n ${RED}>>git checkout master\n\n${NC}"
git checkout master
printf "\n\n${ECOMMERCE_IDENTITY}:\n\n ${RED}>>git pull\n\n${NC}"
git pull
#ecommerce-tools
printf "${PURPLE}######################## ${ECOMMERCE_TOOLS} ########################${NC}"
cd "$(dirname "$0")\.."
cd ./ecommerce-tools
printf "\n\n${ECOMMERCE_TOOLS}:\n\n ${RED}>>git status\n\n${NC}"
git status
printf "\n\n${ECOMMERCE_TOOLS}:\n\n ${RED}>>git reset head --hard\n\n${NC}"
while true; do
printf "\n"
read -p "Do you wish to reset this repo? = ${ECOMMERCE_TOOLS}" yn
printf "Response: ${yn}\n\n"
case $yn in
"") git reset head --hard;break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no";;
esac
done
printf "\n\n${ECOMMERCE_TOOLS}:\n\n ${RED}>>git clean -fd\n\n${NC}"
git clean -fd
printf "\n\n${ECOMMERCE_TOOLS}:\n\n ${RED}>>git checkout master\n\n${NC}"
git checkout master
printf "\n\n${ECOMMERCE_TOOLS}:\n\n ${RED}>>git pull\n\n${NC}"
git pull