-
Notifications
You must be signed in to change notification settings - Fork 0
/
corego_release.sh
executable file
·49 lines (30 loc) · 1.1 KB
/
corego_release.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
#!/bin/bash
cd corego
argc=$#
argv=("$@")
# current Git branch
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
# checkout to master branch, this will break if the user has uncommited changes
git checkout $branch
for (( j=1; j<argc; j++ )); do
if [ "${argv[0]}" = "master" ] && [ $branch = "master" ]; then
echo "master!"
# checkout to master branch, this will break if the user has uncommited changes
git checkout --track "origin/master-${argv[j]}"
# pull the latest version of the code from master
git pull origin "master-${argv[j]}"
git merge --no-edit master
git push --set-upstream origin "master-${argv[j]}"
elif [ "${argv[0]}" = "t0" ] && [ $branch = "staging" ]; then
echo "t0!"
# checkout to "t0-${argv[j]}" branch, this will break if the user has uncommited changes
git checkout "t0-${argv[j]}"
# pull the latest version of the code from "t0-${argv[j]}"
git pull origin "t0-${argv[j]}"
git merge --no-edit staging
git push --set-upstream origin "t0-${argv[j]}"
else
echo "unknown arg[0]: ${argv[0]} or current branch is not correct"
break
fi
done