-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone
executable file
·39 lines (31 loc) · 921 Bytes
/
clone
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
#!/bin/bash
#GITCLONE Script
#(C) 2016, Alesson Renato, <[email protected]>
#Usage:
#just type $clone 'gitUSER' 'repository'
#change 'def' for your gitUSER
def='alessonrenato'
git='.git'
b='-b'
#testa argumentos
if [ $# -lt 1 ];
then
echo "error! type clone 'gitID' 'repository' (without .git)"
exit 1
#1 argumento tenta achar repositorio em meu git
elif [ $# -lt 2 ];
then
#apaga pasta se ela existe
rm -rf $1
#clona, cria develop e features e atualiza
git clone [email protected]:$def/$1$git && cd $1 && git fetch origin && git co $b develop && git pull origin develop && git co $b features
#2 argumentos clona de outro gitUser
elif [ $# -lt 3 ];
then
#apaga pasta se ela existe
rm -rf $2
#clona, cria develop e features e atualiza
git clone [email protected]:$1/$2$git && cd $2 && git fetch origin && git co $b develop && git pull origin develop && git co $b features
else
echo 'error, many arguments'
fi