-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcreate_release_branch.sh
65 lines (55 loc) · 1.43 KB
/
create_release_branch.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
#!/bin/sh
#
# Create release branches from develop
#
# 1. TAG the project to the target version.
# 2. Start Release branch
# 3. Push changes to the upstream.
#
# by Keiichiro Ono (UC, San Diego)
#
###############################################################################
##### Target Repositories #####
REPOSITORIES=(parent api support impl gui-distribution app-developer)
#
# Reset all local changes.
# This deletes all local changes!
#
function resetAll {
git checkout master
git reset --hard $(git branch -av | grep "remotes/origin/master" | awk '{ print $2 }')
git checkout develop
git reset --hard $(git branch -av | grep "remotes/origin/develop" | awk '{ print $2 }')
git checkout $branch
git reset --hard $(git branch -av | grep "remotes/origin/$branch" | awk '{ print $2 }')
git branch -avv
}
###### Main #####
while getopts 'c:' OPT
do
case $OPT in
c) FLG_C=1
branch="$OPTARG"
;;
?) echo $ERROR_MESSAGE 1>&2
exit 1 ;;
esac
done
#######################################
# Reset everything #
#######################################
if [ "$FLG_C" ]; then
echo " - Clear option is ON."
# Cleanup and exit
if [ -z $branch ]; then
echo "Branch name is required to reset."
exit 1
fi
for project in "${REPOSITORIES[@]}"; do
echo "\n - Resetting local changes: $project"
cd ../$project
resetAll
done
echo "\n\n - Everything had been reset to HEAD of remote branches."
exit 0
fi