-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgit.sh
executable file
·57 lines (54 loc) · 1.31 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
LABURL="https://gitlab.com/eda-developers/.git"
HUBURL="https://github.com/jayant-sharma/ft2232h-fifo.git"
if [[ $2 == 'lab' ]]
then
if [ $1 == 'init' ]
then
git remote add origin $LABURL
echo "gitlab remote added"
elif [ $1 == 'seturl' ]
then
git remote set-url origin $LABURL
echo "gitlab remote added"
elif [ $1 == 'push' ]
then
git remote set-url origin $LABURL
git push -u origin master
echo "gitlab remote pushed"
elif [ $1 == 'fpush' ]
then
git push -f origin master
echo "gitlab remote pushed"
else
echo "No command! Provide valid git operation as first argument."
fi
elif [[ $2 == 'hub' ]]
then
if [ $1 == 'init' ]
then
git remote add origin $HUBURL
echo "github remote added"
elif [ $1 == 'seturl' ]
then
git remote set-url origin $HUBURL
echo "github remote added"
elif [ $1 == 'push' ]
then
git remote set-url origin $HUBURL
git push -u origin master
echo "github remote pushed"
elif [ $1 == 'fpush' ]
then
git push -f origin master
echo "github remote pushed"
else
echo "No command! Provide valid git operation as first argument."
fi
elif [ $1 == 'help' ]
then
echo "<arg1> <arg2>"
echo "<arg1> : git operation - init, push, fpush, pull, seturl"
echo "<arg1> : repository - lab, hub"
else
echo "No git repository mentioned! Use --help"
fi