-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_sync_server.sh
More file actions
executable file
·68 lines (60 loc) · 2.1 KB
/
Copy pathcode_sync_server.sh
File metadata and controls
executable file
·68 lines (60 loc) · 2.1 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
#!/bin/bash
# set server-url: "http://git.buildroot.net/git/buildroot.git" or "git://git.buildroot.net/buildroot"
echo "############### Begin sync local code to remote origin #########################"
echo
proxy=$1
if [ "$proxy" = "http" ]; then
git remote set-url origin http://git.buildroot.net/git/buildroot.git
else
git remote set-url origin git://git.buildroot.net/buildroot
fi
git fetch
git pull --rebase
# Look for the remote origin
echo "##################################################################################"
echo
git remote show origin
echo "##################################################################################"
echo
# ----------------------------------------------------------
# set server-url: "https://github.com/cailiwei/buildroot.git" or "git@github.com:cailiwei/buildroot.git"
if [ "$proxy" = "http" ]; then
git remote set-url origin https://github.com/cailiwei/buildroot.git
else
git remote set-url origin git@github.com:cailiwei/buildroot.git
fi
# there is a bug: if master pull failed then push to next, it's an error
echo "New, you need to confirm 'git pull --rebase' successfully ???"
echo "And then type 'y' to push local master branch to server origin next branch, type 'n' to quit convertion..."
read reply leftover
case $reply in
y* | Y*)
echo "git push origin master:next!"
git push origin master:next;;
*)
echo "Well, you quited convertion!"
exit 0;;
esac
git pull --rebase
var=`git branch | awk '{print $1}' | grep "next"`
if [ "$var" = "next" ]; then
echo
echo "Already have the 'next' branch, so execute: git pull --rebase "
git stash
git checkout next
else
echo
echo "Don't have the 'next' branch, so execute: git checkout -b next origin/next "
git stash
git checkout -b next origin/next
fi
git pull --rebase
git checkout master
git stash pop
git merge next
# Look for the remote origin info
git remote show origin
# ----------------------------------------------------------
echo "################### End of sync ######################################################"
echo "Now please execute: 'git push origin master' to sync local to server 'master' branch"
echo