-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.sh
More file actions
executable file
·94 lines (91 loc) · 1.69 KB
/
Copy pathgit.sh
File metadata and controls
executable file
·94 lines (91 loc) · 1.69 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
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
#!/bin/bash
if [ -z $1 ]; then
perl -E 'say "\033[31m"'
echo "error: empty parameter"
echo "use -h or --help to get help"
perl -e 'print "\033[0m"'
exit 0
fi
case $1 in
"-h" | "--help")
perl -E 'say "\033[36m"'
echo "-h | --help"
echo " get help message"
echo "-s | --status"
echo " get repository status"
echo "-p | --pull"
echo " pull commits"
echo "-a | --add <file>"
echo " add file to git"
echo "-r | --remove <file>"
echo " remove file from git"
echo "-k | --checkout <file>"
echo " checkout file"
echo "-c | --commit <message>"
echo " commit and push"
echo "-u | ultimate <message>"
echo " add & commit & push"
;;
"-s" | "--status")
perl -E 'say "\033[35m"'
git status
;;
"-p" | "--pull")
perl -E 'say "\033[36m"'
git pull
;;
"-a" | "--add")
if [ -z $2 ]; then
git add --all
else
git add $2
fi
;;
"-r" | "--remove")
if [ -z $2 ]; then
echo "error: empty parameter"
echo "usage: gg -r <file>"
else
git rm $2
fi
;;
"-k" | "--checkout")
if [ -z $2 ]; then
perl -E 'say "\033[36m"'
echo "error: empty parameter"
echo "ussage: gg -k <file>"
else
git checkout "$2"
perl -E 'say "\033[32m"'
git status
fi
;;
"-c" | "--commit")
if [ -z $2 ]; then
git commit -m "default commit messege"
else
git commit -m "$2"
fi
git push
perl -E 'say "\033[32m"'
git status
;;
"-u" | "--ultimate")
git add --all
if [ -z $2 ]; then
git commit -m "default commit messege"
else
git commit -m "$2"
fi
git push
perl -E 'say "\033[32m"'
git status
;;
*)
perl -E 'say "\033[31m"'
echo "error: unknown parameter"
echo "usage -h or --help to get help"
;;
esac
perl -E 'say "\033[0m"'
exit 0