-
Notifications
You must be signed in to change notification settings - Fork 7
/
sync_repo.sh
executable file
·82 lines (76 loc) · 1.62 KB
/
sync_repo.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
#!/bin/bash
# -*- coding: utf-8 -*-
#
# Date: 2009/2/17
# Author: billy3321
# A simple script use to sync your repo with others.
#
function push_repo (){
while true
do
read -p "Pull success. Continue push to your repo?(Y/n)" PUSH_REPO
case $PUSH_REPO in
"Y"|"y"|"")
git push && echo "Push success."
break
;;
"N"|"n")
echo "Stop push."
break
;;
*)
echo "Please enter a choice."
;;
esac
done
}
function choice_branch(){
read -p "Enter the branch you want to merge or push enter to merge to master:" BRANCH
if [ -z $BRANCH ];then
BRANCH="master"
fi
}
echo "Whos repo you want to sync?"
echo "1. hychen"
echo "2. billy3321"
echo "3. yurenju"
echo "4. aminzai"
echo "5. c9s"
echo "0. others"
echo "q. cancel"
echo "Please enter your choice:"
read -p "What do you want to do now? Please enter the number:" ACT
case $ACT in
"1")
choice_branch
git pull git://github.com/hychen/lazyscript_pool.git $BRANCH && push_repo
;;
"2")
choice_branch
git pull git://github.com/billy3321/lazyscripts_pool_debian_ubuntu.git $BRANCH && push_repo
;;
"3")
choice_branch
git pull git://github.com/yurenju/lazyscripts_pool_debian_ubuntu.git $BRANCH && push_repo
;;
"4")
choice_branch
git pull git://github.com/aminzai/lazyscripts_pool_debian_ubuntu.git $BRANCH && push_repo
;;
"5")
choice_branch
git pull git://github.com/c9s/lazyscripts_pool_debian_ubuntu.git $BRANCH && push_repo
;;
"0")
read -p "Please enter the git repo:" URL
choice_branch
git pull $URL $BRANCH && push_repo
;;
"q")
exit
;;
*)
echo "Please enter a number."
;;
esac
#END