-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.sh
executable file
·186 lines (174 loc) · 3.07 KB
/
git.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env bash
# Created By Jugal Kishore -- 2020
# Git Helper
function NEWLINE() {
echo ""
}
function Status() {
git status
}
function Update() {
git fetch origin master
git pull origin master
}
function Add() {
git add "$Name"
}
function Commit() {
git commit -m "$Message"
}
function Add_Commit() {
git add "$Name"
git commit -m "$Message"
}
function Push() {
git push origin master
}
function Remote_View() {
git remote -v
}
function Remote_Add() {
git remote add "$RNAME" "$RURL"
}
function Remote_Remove() {
git remote remove "$RNAME"
}
while true; do
clear
echo "Git Helper"
NEWLINE
echo "Options -"
NEWLINE
echo "1. Git Status"
echo "2. Git Update (Fetch & Pull)"
echo "3. Git Add"
echo "4. Git Commit"
echo "5. Git Add & Commit"
echo "6. Git Push"
echo "7. Git Remote View"
echo "8. Git Remote Add"
echo "9. Git Remote Remove"
echo "10. Exit"
NEWLINE
echo "Your Choice?"
read -r choice
if [[ $choice == 1 ]]; then
clear
echo "Git Status"
NEWLINE
Status
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 2 ]]; then
clear
echo "Git Update"
NEWLINE
echo "Note: - It always pull from 'origin/master'"
NEWLINE
Update
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 3 ]]; then
clear
echo "Git Add"
NEWLINE
echo "Usage -"
NEWLINE
echo "All Files --> '.' (period)"
echo "Single File --> 'File_Name'"
NEWLINE
echo "Changes:"
NEWLINE
git status -s
NEWLINE
echo "Your Choice?"
read -r Name
Add
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 4 ]]; then
clear
echo "Git Commit"
NEWLINE
echo "Enter Commit Message"
read -r Message
Commit
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 5 ]]; then
clear
echo "Git Add & Commit"
echo "Usage for git add -"
NEWLINE
echo "All Files --> '.' (period)"
echo "Single File --> 'File_Name'"
NEWLINE
echo "Your Choice?"
read -r Name
echo "Enter Commit Message"
read -r Message
Add_Commit
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 6 ]]; then
clear
echo "Git Push"
NEWLINE
Push
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 7 ]]; then
clear
echo "Git Remote View"
NEWLINE
Remote_View
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 8 ]]; then
clear
echo "Git Remote Add"
NEWLINE
echo -e "Enter Remote Name"
read -r RNAME
NEWLINE
echo "Enter Remote URL for '${RNAME}'"
read -r RURL
Remote_Add
NEWLINE
echo "Remote '${RNAME}' of URL '${RURL}' added."
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 9 ]]; then
clear
echo "Git Remote Remove"
NEWLINE
echo "Available Remotes"
NEWLINE
Remote_View
NEWLINE
echo "Enter Remote Name to be Removed"
read -r RNAME
NEWLINE
echo "Entered Remote to be Removed '${RNAME}'"
Remote_Remove
NEWLINE
echo "Remote '${RNAME}' Removed."
NEWLINE
read -rp "Press enter to continue"
fi
if [[ $choice == 10 ]]; then
clear
echo "Have a Nice Day!"
echo "Exiting..."
clear
exit
fi
done