-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsync_repo.sh
executable file
·77 lines (71 loc) · 1.52 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
#!/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. xiangyang17"
echo "2. billy3321"
echo "3. aminzai"
echo "4. mrmoneyc"
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/xiangyang17/lazyscripts_pool_centos_fedora.git $BRANCH && push_repo
;;
"2")
choice_branch
git pull git://github.com/billy3321/lazyscripts_pool_centos_fedorafedora.git $BRANCH && push_repo
;;
"3")
choice_branch
git pull git://github.com/aminzai/lazyscripts_pool_fedora.git $BRANCH && push_repo
;;
"4")
choice_branch
git pull git://github.com/mrmoneyc/lazyscripts_pool_fedora.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