-
Notifications
You must be signed in to change notification settings - Fork 0
/
ap.sh
executable file
·109 lines (91 loc) · 2.05 KB
/
ap.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
#!/bin/bash
function SetupFun() {
clear
echo "Running New Setup Fun!!"
echo ""
rm -rf .git
git init
git add .
echo ""
echo "-----------------------"
echo "Email!"
echo "-----------------------"
read -r useremail
git config user.email "$useremail"
echo ""
echo "-----------------------"
echo "Name!"
echo "-----------------------"
read -r username
git config user.name "$username"
echo ""
git commit -m "first commit"
git branch -M main
echo "-----------------------"
echo "Remote Addr!"
echo "-----------------------"
read -r remoteaddr
git remote add origin "$remoteaddr"
git push -u origin main
echo ""
echo "Setup completed, run ap.sh again!"
}
function PushFun() {
if [[ "$1" == "U" ]]; then
clear
git pull --ff origin main
fi
git add .
clear
echo ""
echo "------------------"
echo "Enter your commit"
echo "------------------"
echo ""
read -r commitmsg
echo ""
git commit -m "$commitmsg"
clear
echo ""
if [[ "$2" == "F" ]]; then
git push -u -f origin main
else
git push -u origin main
fi
}
echo ""
echo "-------------------------------"
echo "This is an script which will"
echo "help you with github cmds."
echo "-------------------------------"
echo ""
echo "Checking setup already done or not!"
echo ""
if [ -a ".git" ]; then
echo "Setup already done!"
echo ""
echo "-------------------------------"
echo "N for New Setup."
echo "P for Push."
echo "U for Update."
echo "FU for Update. (resolve non-fast-forward)"
echo "-------------------------------"
echo ""
read -r optiony
echo ""
if [[ "$optiony" == "N" ]]; then
SetupFun
elif [[ "$optiony" == "P" ]]; then
PushFun
elif [[ "$optiony" == "U" ]]; then
PushFun "U"
elif [[ "$optiony" == "FU" ]]; then
PushFun "U" "F"
else
echo ""
echo 'Choose Something!'
echo ""
fi
else
SetupFun
fi